one stop for all game coders..
| Physics Raycasting |
|
|
| Written by CR Team | |||
| Wednesday, 18 February 2009 00:00 | |||
|
We can understand how the newbies feel and a lot of them have been asking about Raycast in Physics Engine. The Raycasting discussed below is related to Physics Engine only and not the Raytracing used in 3D Engines.
Raycasting is the mechanism of collision detection with rays. Raycasting can be done against all types of rigid bodies and terrains. There are two methods provided with Director Ageia Engine RayCastAll() and RayCastClosest() . RayCastAll( ) - Gives a raycast_list of all rigidbodies that are in the path of the ray cast from a origin. In the image shown above,the method would return blue and orange rigid body. The purple and green rigid body would not be in the raycast_list as they donot lie in the path of the cast ray. RayCastClosest( ) - This method returns the reference of the closest rigid body or terrain that is found along the ray from the specified origin and specified direction. The method returns ( raycast_list ) the closest rigid body from the origin on the cast ray. With reference to the image above only the blue rigidbody would be returned. The raycast_list ( just a variable name given ) list containing the following information:
Note: The objects that lie in the cast ray and list returned by the method RayCastAll()will not be in a sorted order, hence you will have to sort it yourself. Fixed with D11 HF3 and D11.5 !
|