Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Creating a jelly cube:

Generate a volumetric jelly cube mesh (3D grid).

Generate a volumetric jelly cube mesh (3D grid)Creates a 3D grid of vertices (gridSize³ total) with surface faces for rendering. Unlike GenerateCubeMesh (surface-only), this creates internal vertices needed for volumetric soft body simulation.

Parameters
gridSizeNumber of vertices per axis (minimum 2). Total vertices = gridSize³
spacingDistance between adjacent vertices (default: 0.1)
Returns
Component::Mesh The generated cube mesh with surface faces
Note
Only surface faces are generated for rendering. Internal vertices are used by the soft body physics system for volumetric simulation.
entity.AddComponent<Mesh>(core, mesh);
entity.AddComponent<SoftBody>(core, SoftBodySettings::Jelly());
Component::Mesh GenerateJellyCubeMesh(uint32_t gridSize, float spacing)
Definition JellyCubeGenerator.cpp:6

a jelly cube: