Nudge Physics
A single file, header-only 3D physics library
|
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...
#include <nudge.h>
Public Attributes | ||
UserData32Bit | user | |
float | aabb_center [3] | |
float | aabb_half_extents [3] | |
float | com_offset [3] | |
float | aabb_enlarged_radius | |
union { | ||
int16_t aux_bodies [NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES] | ||
union { | ||
int32_t i32 [NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES/2] | ||
uint32_t u32 [NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES/2] | ||
int16_t i16 [NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES] | ||
uint16_t u16 [NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES] | ||
int8_t i8 [NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES *2] | ||
uint8_t u8 [NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES *2] | ||
} sk_user | ||
}; | ||
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.
UserData32Bit nudge::BodyInfo::user |
user data: a per-body user space in 7 different variable names that share the same space, so that ONLY one of them must be chosen and used
float nudge::BodyInfo::aabb_center[3] |
[read-only; unused by nudge.h] the axis aligned bounding box center of the body; note that the com_offset has not been stripped from it (it must be summed to strip it from aabb_center)
float nudge::BodyInfo::aabb_half_extents[3] |
[read-only; unused by nudge.h] the axis aligned bounding box half extents of the body (it does not depend on com_offset)
float nudge::BodyInfo::com_offset[3] |
[read-only] the center of mass offset of the body (it's only used in the calculate_graphic_transform_xxx(...) functions)
float nudge::BodyInfo::aabb_enlarged_radius |
[read-only] this radius is the sum of |com_offset|+|aabb_half_extents|, so that it can be used only with the body's transform position (no transform orientation required)
int16_t nudge::BodyInfo::aux_bodies[NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES] |
user data that by default can be used for dynamic bodies ONLY, and that are reset to -1 every frame (but only for dynamic bodies in the c->active_bodies list); they can be used to store body indices, since they are currently in the [0,8192) range
int32_t nudge::BodyInfo::i32[NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES/2] |
user data that can be used for static and kinematic bodies only (and only one of its array variants)
uint32_t nudge::BodyInfo::u32[NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES/2] |
user data that can be used for static and kinematic bodies only (and only one of its array variants)
int16_t nudge::BodyInfo::i16[NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES] |
user data that can be used for static and kinematic bodies only (and only one of its array variants)
uint16_t nudge::BodyInfo::u16[NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES] |
user data that can be used for static and kinematic bodies only (and only one of its array variants)
int8_t nudge::BodyInfo::i8[NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES *2] |
user data that can be used for static and kinematic bodies only (and only one of its array variants)
uint8_t nudge::BodyInfo::u8[NUDGE_BODYINFO_STRUCT_NUM_AUX_BODIES *2] |
user data that can be used for static and kinematic bodies only (and only one of its array variants)
union { ... } nudge::BodyInfo::sk_user |
user data that by default can be used for static and kinematic bodies ONLY (and only one of the available array variants); using c->global_data.flags and/or per-body c->bodies.filters[body].flags we can use this field for dynamic bodies too, at the expense of the "aux_bodies" field
union { ... } nudge::BodyInfo |