Nudge Physics
A single file, header-only 3D physics library
|
Main struct of the library. More...
#include <nudge.h>
Public Attributes | |
Arena | arena |
BodyData | bodies |
ColliderData | colliders |
ContactData | contact_data |
ContactCache | contact_cache |
ActiveBodies | active_bodies |
KinematicData | kinematic_data |
GlobalData | global_data |
SimulationParams | simulation_params |
const unsigned | MAX_NUM_BOXES |
const unsigned | MAX_NUM_SPHERES |
const unsigned | MAX_NUM_BODIES |
UserData64Bit | user |
Main struct of the library.
Arena nudge::context_t::arena |
[internal usage]
BodyData nudge::context_t::bodies |
accessor to the main physics data of the library
ColliderData nudge::context_t::colliders |
accessor to the (global) collider (i.e. collision shape) (box and sphere) arrays. These arrays can be reordered by nudge, but their 'tags' are unique and are automatically assigned and preserved (please NEVER touch them); it's NOT safe to store array indices in colliders.boxes or collider.spheres! Always use c->bodies.infos[body].first_box_index and c->bodies.infos[body].num_boxes instead (same for spheres)
ContactData nudge::context_t::contact_data |
accessor to the array of contacts, so that users can understand if a body is in contact with another. Please note that only dynamic non-sleeping bodies are guaranteed to report all their contacts every frame AFAIK
ContactCache nudge::context_t::contact_cache |
accessor to the persistent (across frames) CachedContactImpulses that are used to implement warmstarting (used to slightly improved stacking AFAIK); users should simply ignore it
ActiveBodies nudge::context_t::active_bodies |
accessor to an array of active bodies. AFAICU this array has something to do with bodies that have contacts between them (however for some strange reason even sleeping bodies can be in the list). I personally prefer using the official c->bodies array (more robust and thrustable)
KinematicData nudge::context_t::kinematic_data |
accessor to the KinematicData::key_frames array and the KinematicData::animations array that can be used to move kinamatic bodies in an automatic way
GlobalData nudge::context_t::global_data |
accessor to some global fields that don't fit the SimulationParams category
SimulationParams nudge::context_t::simulation_params |
accessor to some global fields that deal with the physic simulation, such as the simulation time_step, the max_num_substeps, sleeping thresholds, damping factors, etc.
const unsigned nudge::context_t::MAX_NUM_BOXES |
fixed value of the max number of box colliders that can be used in the simulation;
const unsigned nudge::context_t::MAX_NUM_SPHERES |
fixed value of the max number of sphere colliders that can be used in the simulation;
const unsigned nudge::context_t::MAX_NUM_BODIES |
fixed value that should always be equal to: MAX_NUM_BOXES+MAX_NUM_SPHERES; this value is only reachable when a single collider per body is used
UserData64Bit nudge::context_t::user |
user data: a per-context user space in 11 different variable names that share the same space, so that ONLY one of them must be chosen and used