The raycast query is a way to detect collisions by using rays, just like how we use the laser pointing device during any slide show presentation, which creates a red dot on the first object its ray collides with. Raycast queries have many uses, such as detecting bullet collision point in an FPS game, checking line of sight for the enemy characters, and selecting in-game objects by using a mouse.
In PhysX, raycasting is done by calling the PxScene::raycast()
function and it can be used in different modes depending on the arguments you are passing to the function; they are described as follows:
raycast()
withPxRaycastBuffer buf
andPxQueryFlag::eANY_HIT
raycast()
withPxRaycastBuffer buf
and a default constructorraycast()
withPxRaycastBuffer buf(PxRaycastBuffer, PxU32)
When using the raycast()
function
with PxQueryFlag::eANY_HIT
, it just returns true
on colliding with any PhysX object. It is the least expensive to call, because it doesn't perform any calculation related...