Nodes
Cluster#
This sample demonstrates dynamic manipulation of ObjectMeshCluster in UNIGINE, showcasing how to add/remove mesh instances at runtime through user interaction. A Mesh Cluster allows you to bake identical meshes (with the same material applied to their surfaces) into a single object, which provides less cluttered spatial tree, reduces the number of texture fetches and speeds up rendering.
Core Features:
- Placement and Removal - click on empty ground adds a new mesh at the clicked position, click on existing cluster geometry removes the selected mesh instance from the cluster
- Raycasting and Intersection Testing - casts a ray from the camera through the mouse position to detect whether the user clicked on a cluster mesh or terrain
Use Cases:
- Scattering objects like rocks, grass, or debris
- Dynamic level editing and environment design
- Performance-sensitive applications with many similar mesh instances.
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/nodes/cluster
Clutter-to-Cluster Converter#
This sample demonstrates how to dynamically generate a clutter (ObjectMeshClutter) and convert it into an optimized cluster (ObjectMeshCluster) in real time. The clutter is generated using a random seed, and the conversion process transfers all key parameters from the clutter: materials, surface properties, LOD, shadows, physics, and collision settings.
The resulting cluster inherits the clutter's transform and hierarchy, but lets you selectively edit and remove individual elements of the group. Very often when building your worlds it is necessary to scatter meshes across a certain area randomly and then reposition some of them manually (e.g. when creating forests).
UI Features:
- Generate Clutter - Creates a randomized layout of clutter meshes.
- Convert to Cluster - Merges all clutter instances into a single ObjectMeshCluster with identical visual/physical behavior.
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/nodes/clutter_to_cluster
Nodes Creation and Deletion#
This sample demonstrates how to dynamically create and delete node instances at runtime in UNIGINE.
A specified .node asset is instantiated repeatedly at timed intervals, with each new instance positioned in a grid pattern. Once a certain number of nodes are active, the oldest ones are automatically removed (first-in, first-out deletion) to maintain a fixed, memory-safe maximum count in the scene.
Use Cases:
- Object pooling and controlled instancing
- Spawning projectiles, enemies, or temporary effects
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/nodes/create_delete_nodes
Primitives Creation#
This sample demonstrates how to create parametric 3D primitives at runtime in UNIGINE. It showcases the use of the Mesh class and ObjectMeshDynamic nodes to procedurally generate a variety of basic shapes (Box, Sphere, Cylinder, Capsule, Prism with a custom number of sides and Plane) via code.
Each shape is constructed with a customizable size and resolution, added to a mesh surface, and placed in the world at a designated position. This approach allows dynamic geometry generation for tools, editor extensions, procedural environments, and rapid prototyping.
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/nodes/create_primitives
Buoyancy#
This sample demonstrates realistic water interaction in UNIGINE, showcasing both the current state of Global Water control via changing Beaufort levels and the use of fetching the water level at a certain point for a simplified simulation of buoyancy without engaging Physics.
Core Features:
Global Water Control. Adjust ocean conditions in real-time using the Beaufort slider (0-12). Higher values create stormier waves with enhanced foam and detail.
Optimized Buoyancy System. Simulates floating objects without full physics collisions. Uses three anchor points for stable wave-following behavior. It then smoothly adjusts the object's position and rotation to match the waves, with calculations based on:
- Object mass (customizable)
- Global buoyancy coefficient (adjustable via Buoyancy slider)
- Water surface steepness and wave height.
Use Cases:
- Marine simulations
- Weather system prototyping
- Performance-sensitive scenes with many floating objects
- Games needing stylized water interactions.
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/nodes/water_buoyancy
Physical Buoyancy#
This sample demonstrates how to implement physically accurate buoyancy for dynamic objects floating on Global Water. A physical body is divided into a grid of virtual volume elements, each sampled independently for water height. Based on how much of each cell is submerged, the system:
- Calculates and applies distributed buoyant forces
- Adds appropriate torque to simulate rotation
- Applies linear and angular damping depending on submerged volume.
You can also define a custom center of mass, and optionally enable debug visualization of submerged sections, force directions, and sampling points via API. Use the Global Water object across different Beaufort slider parameter to adjust wave intensity.
This approach is useful for games and simulators involving boats, ships, debris, or physics-based water interactions.
SDK Path: <SDK_INSTALLATION>data/csharp_component_samples/nodes/water_physical_buoyancy
The information on this page is valid for UNIGINE 2.20 SDK.