Nudge Physics
A single file, header-only 3D physics library
Loading...
Searching...
No Matches
nudge Namespace Reference

Namespaces

namespace  extra
 

Classes

struct  ActiveBodies
 The ActiveBodies struct. More...
 
struct  Arena
 The Arena struct used internally. More...
 
struct  BodyConnections
 [unused] The BodyConnections struct is actually just sketched in nudge (it was intended to add custom constraints) More...
 
struct  BodyData
 The main struct contained in context_t: it exposes every per-body data in the simulation, except collisions. More...
 
struct  BodyFilter
 The BodyFilter struct. More...
 
struct  BodyInfo
 The BodyInfo struct contains some read-only graphic properties of the body (e.g. axis aligned bounding box and center of mass offset), and plenty of per-body user available space, handy to bind user-side structs to a nudge physic body. More...
 
struct  BodyLayout
 Per-body struct that contains the indices of the body colliders inside ColliderData::boxes and ColliderData::spheres. More...
 
struct  BodyMomentum
 The BodyMomentum struct. More...
 
struct  BodyPair
 The BodyPair struct. More...
 
struct  BodyProperties
 The BodyProperties struct. More...
 
struct  BoxCollider
 The BoxCollider struct. More...
 
struct  CachedContactImpulse
 The CachedContactImpulse struct. More...
 
struct  ColliderData
 This struct is used to access all the colliders in the physic world. More...
 
struct  Contact
 The Contact struct. More...
 
struct  ContactCache
 The ContactCache struct contains the CachedContactImpulse and persists across frames. More...
 
struct  ContactData
 The ContactData class. More...
 
struct  context_t
 Main struct of the library. More...
 
struct  GlobalData
 The GlobalData struct inglobes global fields that could not fit in the SimulationParams struct. More...
 
struct  KinematicData
 The KinematicData is composed by two arrays: an array of global key frames and an array of animations. Each animation owns a (kinematic) body index and a range of key frames. More...
 
struct  SimulationParams
 The SimulationParams struct. More...
 
struct  SphereCollider
 The SphereCollider struct. More...
 
struct  Transform
 The Transform struct. More...
 
union  UserData32Bit
 Storage struct for user data (by default used inside BodyInfo): a per-body 32-bit user space in 7 different variable names that share the same space, so that ONLY one of them must be chosen and used. More...
 
union  UserData64Bit
 Storage struct for user data (by default used inside context_t): a per-context 64-bit user space in 11 different variable names that share the same space, so that ONLY one of them must be chosen and used. More...
 

Typedefs

typedef NUDGE_COLLISION_MASK_TYPE CollisionMask
 The unsigned type used for the COLLISION_GROUP_ flags; it defaults to uint8_t (i.e. 8 groups available) if C++11 is supported and NUDGE_USE_INT32_ENUMS is not defined, and to uint32_t otherwise (i.e. 32 groups available)
 
typedef NUDGE_FLAG_MASK_TYPE FlagMask
 The unsigned type used for the BF_ flags; it defaults to uint16_t (i.e. 16 flags available) if C++11 is supported and NUDGE_USE_INT32_ENUMS is not defined, and to uint32_t otherwise (i.e. 32 flags available)
 

Enumerations

enum  CollisionMaskEnum : CollisionMask {
  COLLISION_GROUP_DEFAULT = 1<<0 , COLLISION_GROUP_A = 1<<1 , COLLISION_GROUP_B = 1<<2 , COLLISION_GROUP_C = 1<<3 ,
  COLLISION_GROUP_D = 1<<4 , COLLISION_GROUP_E = 1<<5 , COLLISION_GROUP_F = 1<<6 , COLLISION_GROUP_G = 1<<7 ,
  COLLISION_GROUP_ALL = (CollisionMask)(-1)
}
 The CollisionMaskEnum enum. More...
 
enum  BodyFlagEnum : FlagMask {
  BF_HAS_COM_OFFSET = 1<<0 , BF_IS_DISABLED = 1<<1 , BF_IS_REMOVED = 1<<2 , BF_IS_DISABLED_OR_REMOVED = BF_IS_DISABLED|BF_IS_REMOVED ,
  BF_IS_STATIC = 1<<3 , BF_IS_KINEMATIC = 1<<4 , BF_IS_DYNAMIC = 1<<5 , BF_NEVER_SLEEPING = 1<<6 ,
  BF_HAS_DIFFERENT_GRAVITY_MODE = 1<<7 , BF_HAS_DIFFERENT_AUX_BODIES_RESET_MODE = 1<<8 , BF_IS_CHARACTER = 1<<9 , BF_IS_PLATFORM = 1<<10 ,
  BF_IS_SENSOR = 1<<11 , BF_IS_FRUSTUM_CULLED = 1<<12 , BF_IS_DISABLED_OR_REMOVED_OR_FRUSTUM_CULLED = BF_IS_DISABLED_OR_REMOVED|BF_IS_FRUSTUM_CULLED , BF_IS_STATIC_OR_KINEMATIC = BF_IS_STATIC|BF_IS_KINEMATIC ,
  BF_IS_STATIC_OR_DYNAMIC = BF_IS_STATIC|BF_IS_DYNAMIC , BF_IS_KINEMATIC_OR_DYNAMIC = BF_IS_KINEMATIC|BF_IS_DYNAMIC , BF_IS_STATIC_OR_KINEMATIC_OR_DYNAMIC = BF_IS_STATIC|BF_IS_KINEMATIC|BF_IS_DYNAMIC , BF_IS_STATIC_OR_KINEMATIC_OR_DISABLED_OR_REMOVED = BF_IS_STATIC_OR_KINEMATIC|BF_IS_DISABLED_OR_REMOVED
}
 The BodyFlagEnum enum. More...
 
enum  GlobalDataMaskEnum { GF_USE_GLOBAL_GRAVITY = 1<<0 , GF_DONT_RESET_AUX_BODIES = 1<<1 }
 The GlobalDataMaskEnum enum. More...
 
enum  AxisEnum { AXIS_X =0 , AXIS_Y =1 , AXIS_Z =2 }
 The AxisEnum enum. More...
 

Functions

void show_info ()
 Displays basic info at program startup; very important call to detect the SIMD configuration of the program.
 
void init_context_with (context_t *c, unsigned MAX_NUM_BOXES, unsigned MAX_NUM_SPHERES)
 Mandatory function to be called at program startup.
 
void init_context (context_t *c)
 Mandatory function to be called at program startup.
 
void destroy_context (context_t *c)
 Mandatory function to be called at program exit.
 
void restart_context (context_t *c)
 Optional function that restarts a valid context, preserving the simulation settings and the allocated memory.
 
void save_context (FILE *f, const context_t *c)
 Saves the nudge context.
 
void load_context (FILE *f, context_t *c)
 Loads a saved nudge context.
 
unsigned pre_simulation_step (context_t *c, double elapsedSecondsFromLastCall)
 Mandatory function that must be called once per frame.
 
void simulation_step (context_t *c)
 Mandatory function that must be called once per frame.
 
float * calculate_graphic_transform_for_body (context_t *c, unsigned body, float *pModelMatrix16Out)
 Function that can be used to calculate the smoothed 16-float column-major model matrix of a single body.
 
void calculate_graphic_transforms (context_t *c, float *pModelMatricesOut, unsigned modelMatrixStrideInFloatUnits, int loopActiveBodiesOnly=0)
 Function that can be used to calculate the smoothed 16-float column-major model matrices of all the bodies together.
 
unsigned add_box (context_t *c, float mass, float hsizex, float hsizey, float hsizez, const Transform *T=NULL, const float comOffset[3]=NULL)
 Adds a new body to the simulation with a single box collider.
 
unsigned add_box (context_t *c, float mass, float hsizex, float hsizey, float hsizez, const float *mMatrix16WithoutScaling, const float comOffset[3]=NULL)
 
unsigned add_sphere (context_t *c, float mass, float radius, const Transform *T=NULL, const float comOffset[3]=NULL)
 Adds a new body to the simulation with a single sphere collider.
 
unsigned add_sphere (context_t *c, float mass, float radius, const float *mMatrix16WithoutScaling, const float comOffset[3]=NULL)
 
unsigned add_compound (context_t *c, float mass, float inertia[3], unsigned num_boxes, const float *hsizeTriplets, const Transform *boxOffsetTransforms, unsigned num_spheres, const float *radii, const Transform *sphereOffsetTransforms, const Transform *T=NULL, const float comOffset[3]=NULL, float *centerMeshAndRetrieveOldCenter3Out=NULL)
 Adds a new body to the simulation with a compound collider made up of num_boxes box colliders and num_spheres sphere colliders.
 
unsigned add_compound (context_t *c, float mass, float inertia[3], unsigned num_boxes, const float *hsizeTriplets, const float *boxOffsetMatrices16WithoutScaling, unsigned num_spheres, const float *radii, const float *sphereOffsetMatrices16WithoutScaling, const float *mMatrix16WithoutScaling=NULL, const float comOffset[3]=NULL, float *centerMeshAndRetrieveOldCenter3Out=NULL)
 
unsigned add_clone (context_t *c, unsigned body_to_clone, float mass, const Transform *T=NULL, float scale_factor=1.f, const float newComOffsetInPreScaledUnits[3]=NULL)
 [Experimental] Adds a new body to the simulation cloning an existing body
 
unsigned add_clone (context_t *c, unsigned body_to_clone, float mass, const float *mMatrix16WithoutScaling, float scale_factor=1.f, const float newComOffsetInPreScaledUnits[3]=NULL)
 
void remove_body (context_t *c, unsigned body)
 Removes a body from the simulation.
 
uint32_t colliders_get_num_remaining_boxes (context_t *c)
 Return the number of box colliders that can still be added to the physic world.
 
uint32_t colliders_get_num_remaining_spheres (context_t *c)
 Return the number of sphere colliders that can still be added to the physic world.
 
int can_add_box (context_t *c)
 
int can_add_sphere (context_t *c)
 
int can_add_compound (context_t *c, unsigned num_boxes, unsigned num_spheres)
 
int can_add_clone (context_t *c, unsigned body_to_clone)
 
unsigned get_next_add_body_index (context_t *c)
 Allows to peek the body index that is going to be returned in next add_xxx(...) call.
 
void body_recalculate_bounding_box (context_t *c, uint32_t body)
 Recalculates the bounding box of the body (BodyInfo::aabb_center and BodyInfo::aabb_extents)
 
void body_change_motion_state (nudge::context_t *c, unsigned body, nudge::FlagMask new_motion_state, float mass_fallback=1.f)
 [Experimental] Changes the body motion state (i.e. the BF_IS_STATIC_OR_KINEMATIC_OR_DYNAMIC group of body flags)
 
void body_scale (nudge::context_t *c, unsigned body, float scale_factor, float mass_scale_factor=0.f)
 [Experimental] Uniformly scales the specified body incrementally
 
float * body_get_velocity (context_t *c, uint32_t body)
 Gets the pointer to the body linear velocity (3-floats)
 
float * body_get_angular_velocity (context_t *c, uint32_t body)
 Gets the pointer to the body angular velocity (3-floats)
 
float * body_get_position (context_t *c, uint32_t body)
 Gets the pointer to the body position (3-floats vector)
 
float * body_get_orientation (context_t *c, uint32_t body)
 Gets the pointer to the body orientation (4-floats quaternion in {x,y,z,w} format)
 
void body_set_collision_group_and_mask (context_t *c, uint32_t body, CollisionMask single_collision_group_body_belongs_to, CollisionMask collision_group_mask_body_can_collide_with=COLLISION_GROUP_ALL)
 Sets the body collision group (a single value of COLLISION_GROUP_) and mask (a combination of COLLISION_GROUP_ values)
 
CollisionMaskbody_get_collision_group (context_t *c, uint32_t body)
 Gets the body collision group (a single value of COLLISION_GROUP_)
 
CollisionMaskbody_get_collision_mask (context_t *c, uint32_t body)
 Gets the body collision mask (a combination of COLLISION_GROUP_ values)
 
FlagMaskbody_get_flags (context_t *c, uint32_t body)
 Shortcut that returns a pointer to the body flags (a combination of BF_ enums)
 
void kinematic_data_reserve_key_frames (KinematicData *kd, size_t new_size)
 Reserves additional space for KinematicData key frames.
 
void kinematic_data_reserve_animations (KinematicData *kd, size_t new_size)
 Reserves additional space for KinematicData animations.
 
int log (const char *format,...)
 Logging function used by the library. It defaults to printf.
 
int flush (void)
 Flushes the log. It defaults to fflush(NUDGE_LOG_FILE_PTR)
 
void contact_data_find_colliders (const context_t *c, unsigned contact_data_index, int16_t *box_collider_index_for_body_a, int16_t *sphere_collider_index_for_body_a, int16_t *box_collider_index_for_body_b, int16_t *sphere_collider_index_for_body_b, int use_relative_values_for_output_indices=0)
 Find out which collider belonging to body_a and body_b is involved in the collision determined by a ContactData index.
 
TransformMat4WithoutScalingToTransform (Transform *Tout, const float *matrix16WithoutScaling)
 Converts a column-major 16-floats matrix without any scaling applied to a nudge::Transform.
 
Transform Mat4WithoutScalingToTransform (const float *matrix16WithoutScaling)
 Converts a column-major 16-floats matrix without any scaling applied to a nudge::Transform.
 
float * TransformToMat4 (float *matrix16Out, const Transform *T)
 Converts a nudge::Transform to a column-major 16-floats matrix.
 
void TransformAssignToBody (context_t *c, unsigned body, Transform newT, float deltaTime, int16_t aux_body=-1)
 Assigns a new Transform to a body, and sets its linear and angular velocities based on the differences between the new transform and the old one: this is essential when manually moving bodies by changing their transform.
 
void TransformAdvanceBodyFromVelocities (context_t *c, unsigned body, float deltaTime)
 Advances the body's transform based on its linear and angular velocities.
 
Transform TransformSlerp (Transform T0, Transform T1, float time)
 Applies (spherical) lerp between T0 and T1.
 
Transform TransformMul (Transform T0, Transform T1)
 Multiplies two transforms.
 
void nm_QuatAdvance (float *__restrict qOut4, const float *__restrict q4, const float *__restrict angVel3, float halfTimeStep)
 Advances a quaternion given an angular velocity and a (small) time step.
 
float * nm_QuatFromMat4 (float *__restrict result4, const float *__restrict m16)
 Turns the 3x3 submatrix of a 16-floats column-major matrix (without scaling applied) into a quaternion.
 
float * nm_Mat4SetRotationFromQuat (float *__restrict result16, const float *__restrict q4)
 Replaces the 3x3 submatrix of a 16-floats column-major matrix with the 3x3 matrix representing the given quaternion.
 
float * nm_QuatFromMat3 (float *__restrict result4, const float *__restrict m9)
 Turns the 3x3 9-floats column-major rotation matrix (without scaling applied) into a quaternion.
 
float * nm_Mat3FromQuat (float *__restrict result9, const float *__restrict q4)
 Converts the given quaternion the a 3x3 9-floats column-major rotation matrix.
 
void nm_QuatGetAngularVelocity (float *__restrict angVel3, const float *newQuat4, const float *oldQuat4, float halfTimeStep)
 Given an old and a new quaternion and a small time step, it calculates the angular velocities.
 
float * nm_QuatSlerp (float *__restrict result4, const float *__restrict a4, const float *__restrict b4, float slerpTime_In_0_1, int normalizeResult4AfterLerp)
 Performs a spherical lerp between two quaternions (in 4-floats format)
 
float * nm_QuatMul (float *qOut4, const float *a4, const float *b4)
 Multiplies two 4-floats quaternions.
 
void nm_QuatNormalize (float *__restrict q4)
 normalizes a 4-floats quaternion in place
 
float * nm_QuatFromAngleAxis (float *__restrict qOut4, float rfAngle, float rkAxisX, float rkAxisY, float rkAxisZ)
 Generates a 4-floats quaternion based on an orientation arouns an axis.
 
void nm_QuatToAngleAxis (const float *__restrict q4, float *__restrict rfAngleOut1, float *__restrict rkAxisOut3)
 Calculates the angle-axis representation of the given 4-float quaternion.
 
float nm_Vec3Normalize (float *__restrict v3)
 Normalizes a 3-floats vector in place.
 
float nm_Vec3Normalized (float *__restrict v3Out, const float *__restrict v3)
 Get a normalizes copy of an input 3-floats vector.
 
float nm_Vec3Dot (const float *__restrict a3, const float *__restrict b3)
 Computes the dot product between two 3-floats vectors.
 
float * nm_Vec3Cross (float *__restrict vOut3, const float *__restrict a3, const float *__restrict b3)
 Computes the cross product between two 3-floats vectors.
 
float * nm_QuatMulVec3 (float *__restrict vOut3, const float *__restrict q4, const float *__restrict vIn3)
 Transforms a 3-floats vector by a 4-floats quaternion.
 
float * nm_QuatGetAxis (float *__restrict vOut3, const float *__restrict q4, float axisX, float axisY, float axisZ)
 Transforms a particular axis from the input quaternion space to word space.
 
float * nm_QuatGetAxisX (float *__restrict axisOut3, const float *__restrict q4)
 
float * nm_QuatGetAxisY (float *__restrict axisOut3, const float *__restrict q4)
 
float * nm_QuatGetAxisZ (float *__restrict axisOut3, const float *__restrict q4)
 
float * nm_QuatRotate (float *__restrict qInOut4, float angle, float axisX, float axisY, float axisZ)
 Rotates an input 4-floats unit quaternion by an angle in radians around a specified axis.
 
float * nm_Mat4Mul (float *result16, const float *ml16, const float *mr16)
 Multiplies two column-major 16-floats 4x4 matrices.
 
void calculate_box_inertia (float result[3], float mass, float hsizex, float hsizey, float hsizez, const float comOffset[3]=NULL)
 
void calculate_sphere_inertia (float result[3], float mass, float radius, const float comOffset[3]=NULL, bool hollow=false)
 
void calculate_cylinder_inertia (float result[3], float mass, float radius, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void calculate_capsule_inertia (float result[3], float mass, float radius, float halfCylinderHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void calculate_torus_inertia (float result[3], float mass, float majorRadius, float minorRadius, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void calculate_hollow_cylinder_inertia (float result[3], float mass, float R, float r, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void calculate_cone_inertia (float result[3], float mass, float radius, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void calculate_box_inertia_inverse (float result[3], float mass, float hsizex, float hsizey, float hsizez, const float comOffset[3]=NULL)
 
void calculate_sphere_inertia_inverse (float result[3], float mass, float radius, const float comOffset[3]=NULL, bool hollow=false)
 
void calculate_cylinder_inertia_inverse (float result[3], float mass, float radius, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void calculate_capsule_inertia_inverse (float result[3], float mass, float radius, float halfCylinderHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void calculate_torus_inertia_inverse (float result[3], float mass, float majorRadius, float minorRadius, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void calculate_hollow_cylinder_inertia_inverse (float result[3], float mass, float R, float r, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 
void calculate_cone_inertia_inverse (float result[3], float mass, float radius, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL)
 

Typedef Documentation

◆ CollisionMask

The unsigned type used for the COLLISION_GROUP_ flags; it defaults to uint8_t (i.e. 8 groups available) if C++11 is supported and NUDGE_USE_INT32_ENUMS is not defined, and to uint32_t otherwise (i.e. 32 groups available)

Note
Always using this typedef for collision group flags is recommended
When C++11 is available the type can be further tuned with the NUDGE_COLLISION_MASK_TYPE definition (having smaller types has benefits on the cache size, not much on the bit operation speed)

◆ FlagMask

The unsigned type used for the BF_ flags; it defaults to uint16_t (i.e. 16 flags available) if C++11 is supported and NUDGE_USE_INT32_ENUMS is not defined, and to uint32_t otherwise (i.e. 32 flags available)

Note
Always using this typedef for body flags is recommended
When C++11 is available the type can be further tuned with the NUDGE_FLAG_MASK_TYPE definition (having smaller types has benefits on the cache size, not much on the bit operation speed)

Enumeration Type Documentation

◆ CollisionMaskEnum

The CollisionMaskEnum enum.

Note
If more groups are required, please see the CollisionMask doc for the available space and add the additional entries in your code: namespace nudge {const CollisionMask COLLISION_GROUP_H=1<<8,COLLISION_GROUP_I=1<<9,...;}
Enumerator
COLLISION_GROUP_DEFAULT 
COLLISION_GROUP_A 
COLLISION_GROUP_B 
COLLISION_GROUP_C 
COLLISION_GROUP_D 
COLLISION_GROUP_E 
COLLISION_GROUP_F 
COLLISION_GROUP_G 
COLLISION_GROUP_ALL 

◆ BodyFlagEnum

The BodyFlagEnum enum.

Note
User can easily add custom flags this way: namespace nudge {const FlagMask BF_IS_MY_TYPE_1=1<<13,BF_IS_MY_TYPE_2=1<<14,BF_IS_MY_TYPE_3=1<<15;}
Flags marked [unused, not implemented] will never be implemented inside nudge.h
To understand how many entries are available, please see the FlagMask doc (by default they are at least 16)
Enumerator
BF_HAS_COM_OFFSET 

read-only [internal usage: automatically set when bodies are created]

BF_IS_DISABLED 

[experimental] if used, it's better to set the body to static, reset its velocities and set its collision group and mask both to zero (TODO: test if this is really necessary)

BF_IS_REMOVED 

read-only [internal flag added when bodies are removed]

BF_IS_DISABLED_OR_REMOVED 

read-only flag useful to filter out bodies excluded from simulation

BF_IS_STATIC 

read-only [internal flag added when bodies are added]

BF_IS_KINEMATIC 

read-only [internal flag added when bodies are added]

BF_IS_DYNAMIC 

read-only [internal flag added when bodies are added]

BF_NEVER_SLEEPING 

[experimental] affects only dynamic bodies

BF_HAS_DIFFERENT_GRAVITY_MODE 

[experimental] inverts the GF_USE_GLOBAL_GRAVITY mode in c->global_data.flags on a per-body base

BF_HAS_DIFFERENT_AUX_BODIES_RESET_MODE 

[experimental] inverts the GF_DONT_RESET_AUX_BODIES mode in c->global_data.flags on a per-body base

BF_IS_CHARACTER 

[unused, not implemented, removable] flag added for user convenience

BF_IS_PLATFORM 

[unused, not implemented, removable] flag added for user convenience

BF_IS_SENSOR 

[unused, not implemented, removable] flag added for user convenience

BF_IS_FRUSTUM_CULLED 

[unused, not implemented, removable] flag added for user convenience

BF_IS_DISABLED_OR_REMOVED_OR_FRUSTUM_CULLED 

[unused, not implemented, removable] flag added for user convenience

BF_IS_STATIC_OR_KINEMATIC 

read-only [internal flag]

BF_IS_STATIC_OR_DYNAMIC 

read-only [internal flag]

BF_IS_KINEMATIC_OR_DYNAMIC 

read-only [internal flag]

BF_IS_STATIC_OR_KINEMATIC_OR_DYNAMIC 

read-only [internal flag]

BF_IS_STATIC_OR_KINEMATIC_OR_DISABLED_OR_REMOVED 

read-only [internal flag]

◆ GlobalDataMaskEnum

The GlobalDataMaskEnum enum.

Enumerator
GF_USE_GLOBAL_GRAVITY 

this flag disables per-body gravity and uses GlobalData::gravity instead (disabled by default)

GF_DONT_RESET_AUX_BODIES 

if set nudge avoids resetting per-body BodyInfo::aux_bodies[] (to -1) every frame (valid for dynamic bodies in the c->active_bodies list only): this allows the use of the BodyInfo::sk_user field for dynamic bodies too (disabled by default)

◆ AxisEnum

The AxisEnum enum.

Enumerator
AXIS_X 
AXIS_Y 
AXIS_Z 

Function Documentation

◆ body_get_velocity()

float * nudge::body_get_velocity ( context_t c,
uint32_t  body 
)
inline

Gets the pointer to the body linear velocity (3-floats)

Parameters
cthe nudge context
bodythe index of the body
Returns
a reference to the body linear velocity (a float3 array)

◆ body_get_angular_velocity()

float * nudge::body_get_angular_velocity ( context_t c,
uint32_t  body 
)
inline

Gets the pointer to the body angular velocity (3-floats)

Parameters
cthe nudge context
bodythe index of the body
Returns
a reference to the body angular velocity (a float3 array)

◆ body_get_position()

float * nudge::body_get_position ( context_t c,
uint32_t  body 
)
inline

Gets the pointer to the body position (3-floats vector)

Parameters
cthe nudge context
bodythe index of the body
Returns
a reference to the body position (a float3 array)

◆ body_get_orientation()

float * nudge::body_get_orientation ( context_t c,
uint32_t  body 
)
inline

Gets the pointer to the body orientation (4-floats quaternion in {x,y,z,w} format)

Parameters
cthe nudge context
bodythe index of the body
Returns
a reference to the body orientation (floats4 quaternion in {x,y,z,w} format)