[ODE] Holding bodies like in HL2
kornerr at gmail.com
Wed Sep 13 03:16:58 MST 2006
Dave wrote in "How to hold objects (like in HL2)":
>> * In your collision callback you need to treat ray / geom collisions
>> as a special case, i.e. instead of the usual contact joint creation to
>> get solid objects colliding you'd detect if "dGeomGetClass( geom ) ==
>> dRayClass" and handle it differently.
>> For this application you want to find the 'nearest colliding body
>> which isn't the player' which will be the target for your gravity gun.
>> The usual call to dCollide will return a number of collisions for the
>> ray, in this case contact 'depth' field actually indicates the
>> distance along the ray to the target. Ignoring the player's geom will
>> allow you to get the nearest thing you're trying to grab with the gun
>> simply using MIN.
So how to get the `nearest colliding body which isn't the player`?
More information about the ODE