newbie's question about raycasting.

ihar3d
Posts: 25
Joined: Wed Jan 23, 2008 11:28 am

newbie's question about raycasting.

Post by ihar3d »

Hello All!
There is an terrain with an raycasting implementation in my project.
I want to use this terrain's feature with Bullet's Vehicle.
And my question - how can I integrate this raycast function with Bullet, which data except intersect point and object's normal in this point should I provide to Vehicle?
Thanks, and I'm sorry for the language, English isn't my native language.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: newbie's question about raycasting.

Post by Erwin Coumans »

You can write your derived class from btVehicleRaycaster (see src\BulletDynamics\Vehicle\btVehicleRaycaster.h) and implement the virtual void* castRay method. This will allow to re-use the btRaycastVehicle with your own raycasting routines.

However, if you want the vehicle chassis to collide with the terrain, you need collision detection. So you might want to use Bullet's collision shapes (btHeightfieldTerrainShape or btBvhTriangleMeshShape) instead.

Hope this helps,
Erwin
ihar3d
Posts: 25
Joined: Wed Jan 23, 2008 11:28 am

Re: newbie's question about raycasting.

Post by ihar3d »

Thanks for the answer!