Nudge Physics
A single file, header-only 3D physics library
Loading...
Searching...
No Matches
Contact Processing Functions

Contact processing is designed to be done directly in the contact_data field of the context_t struct, so here is just a handy function to detect which collider (i.e. collision shape) of each body is involved in a specific collision. More...

Functions

void nudge::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.
 

Detailed Description

Contact processing is designed to be done directly in the contact_data field of the context_t struct, so here is just a handy function to detect which collider (i.e. collision shape) of each body is involved in a specific collision.

Function Documentation

◆ contact_data_find_colliders()

void nudge::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.

Note
Only relevant if body_a (or body_b) has more than one collider assigned to it (i.e. it's a compound body)
Parameters
contact_data_indexin [0,c->contact_data.count)
box_collider_index_for_body_aout param, index in c->colliders.boxes, -1 means that sphere_collider_index_for_body_a>=0
sphere_collider_index_for_body_aout param, index in c->colliders.spheres, -1 means that box_collider_index_for_body_a>=0
box_collider_index_for_body_bout param, index in c->colliders.boxes, -1 means that sphere_collider_index_for_body_b>=0
sphere_collider_index_for_body_bout param, index in c->colliders.spheres, -1 means that box_collider_index_for_body_b>=0
use_relative_values_for_output_indices0 or 1. Absolute values can't be stored. Relative values are relative to the first collider index of the body