Using Bullet Database for simple Ray Intersection collisions

scratt
Posts: 2
Joined: Mon Jun 29, 2009 5:25 am

Using Bullet Database for simple Ray Intersection collisions

Post by scratt »

Hi all.. Hoping someone can point out where to go in the very good, but volumous, docs for this info..

We are using Bullet in it's more traditional form for general dynamics and collision calculations in our simulation. However, we run/activate Bullet selectively as it's not always required in every state / stage of our simulation.

I'd like to have access to shapes within Bullet and do simple immediate Ray->Polygon intersections on specific objects without the overhead of running a full bullet simulation loop as it seems to be implemented in the Simple Collision Interface demo..

I am assuming that at the moment the only way to do this is to call a simulation loop on all objects with some performRaycast(..) having been initiated, and callbacks providing intersection information? Is this the right approach? And if so is it possible to do an immediate call on a single object / triangle mesh?

This would enable us to cut down data duplication, and have Bullet on when it's required.

Can anyone point me to the right demo or docs to read about that..
Thanks.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Using Bullet Database for simple Ray Intersection collisions

Post by Erwin Coumans »

You can use world->rayTest(...) to get the first hit, closest hit or all hits. If you only want to check a single object, use world->rayTestSingle(...)

Check out Bullet/Demos/Raytracer

Hope this helps,
Erwin
scratt
Posts: 2
Joined: Mon Jun 29, 2009 5:25 am

Re: Using Bullet Database for simple Ray Intersection collisions

Post by scratt »

Thanks Erwin, That sounds just like what I need.

One further quick question if you don't mind.
Is it worth running a simulation loop if I have a large number of ray intersection collisions per frame in order to take advantage of batching (SSE or VFP)?

Cheers,
Stephen.