Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Creating a 2-unit jelly cube with 5x5x5 grid:

Create a volumetric jelly cube entity for soft body simulation.

Create a volumetric jelly cube entity for soft body simulationCreates a 3D grid of vertices (gridSize³ total) with surface faces for rendering. Unlike CreateCube (which has only surface vertices), this creates internal vertices needed for volumetric soft body simulation ("jelly" effect).

The spacing between vertices is automatically calculated as: size / (gridSize - 1)

Parameters
coreEngine core reference
infoParameters for creating the jelly cube (size, gridSize, position, rotation, scale)
Returns
Engine::Entity The created entity with mesh and transform
Note
For a standard cube soft body (surface-only deformation), use CreateCube instead. This function is specifically for volumetric "jelly" simulation.
auto jelly = Object::Helper::CreateJellyCube(core, { .size = 2.0f, .gridSize = 5, .position = glm::vec3(0, 5, 0) });
jelly.AddComponent<Physics::Component::SoftBody>(core, SoftBodySettings::Jelly());
decltype(auto) AddComponent(TComponent &&component)
Add a component to an entity.
Definition Entity.hpp:55
Engine::Entity CreateJellyCube(Engine::Core &core, CreateJellyCubeInfo info)
Definition CreateShape.cpp:101
Soft body physics component.
Definition SoftBody.hpp:241

a 2-unit jelly cube with 5x5x5 grid: