Soft2D
A 2D multi-material continuum physics engine designed for real-time applications.
Loading...
Searching...
No Matches
S2WorldConfig Struct Reference

Structure S2WorldConfig More...

#include <soft2d_core.h>

Public Attributes

uint32_t max_allowed_particle_num
 World's capacity of particles.
 
uint32_t max_allowed_body_num
 World's capacity of bodies.
 
uint32_t max_allowed_element_num
 World's capacity of triangle elements.
 
uint32_t max_allowed_trigger_num
 World's capacity of triggers.
 
uint32_t grid_resolution
 The resolution of the world's background grid.
 
S2Vec2 offset
 World's offset. Indicates the location of the world's bottom-left corner.
 
S2Vec2 extent
 
float substep_dt
 
S2Vec2 gravity
 
S2OutWorldBoundaryPolicy out_world_boundary_policy
 
uint32_t enable_debugging
 
uint32_t enable_world_query
 
float mesh_body_force_scale
 A scale factor of mesh body's internal force.
 
float collision_penalty_force_scale_along_normal_dir
 A parameter to prevent particles from penetrating colliders.
 
float collision_penalty_force_scale_along_velocity_dir
 A parameter to prevent particles from penetrating colliders.
 
uint32_t fine_grid_scale
 

Detailed Description

Structure S2WorldConfig

Member Data Documentation

◆ enable_debugging

uint32_t S2WorldConfig::enable_debugging

Enable debugging or not. Enabling this option allows users to export additional buffers (See S2BufferName) for debugging and visualization, consuming more GPU memory.

◆ enable_world_query

uint32_t S2WorldConfig::enable_world_query

Enable world querying or not. Triggers won't work unless this option is enabled. Enabling this option leads to data read-back from GPU to CPU, potentially causing obvious performance degradation.

◆ extent

S2Vec2 S2WorldConfig::extent

World's extent. The world's bounds form a rectangle, with the bottom-left corner at world.offset and top-right corner at world.offset + world.extent.

◆ fine_grid_scale

uint32_t S2WorldConfig::fine_grid_scale

A scale factor of fine grid resolution compared to background grid resolution. This parameter adjusts the precision of colliders when the world uses a relatively coarse grid.

◆ gravity

S2Vec2 S2WorldConfig::gravity

World's gravity acceleration. A commonly used value is (0, -9.8) (meters per second squared).

◆ out_world_boundary_policy

S2OutWorldBoundaryPolicy S2WorldConfig::out_world_boundary_policy

The behavior when a body leaves out of the world. See S2OutWorldBoundaryPolicy.

◆ substep_dt

float S2WorldConfig::substep_dt

The time step of the internal sub-step. A call of s2_step() function is divided into several sub-step iterations in the internal implementation. The number of iterations could be calculated as ceil(dt/substep_dt).


The documentation for this struct was generated from the following file: