Some info on Rays

Aquatix

27-10-2007 03:27:52

Hi again! Spent quite a bit of time playing with OgreBullet this night. It does indeed seem to be much more interesting that Ode was (thanks again, Tuan!).
As my first contribution, I'd like to make a Character Controller for OgreBullet. What kind of a controller? Well, like we discussed here in OgreOde's forum. I already got an 80% accomplished (in terms of features) model in Ode, so I'm just porting it to OgreBullet.
So, I'd like to ask, if anyone, who has already used OgreBullet for some time (I know, there's really no documentation yet) to give me just a few notes (even the tiniest bits would do) about Rays and how they work here.
Especially the following points:

1) Why is there an Ogre(!) Ray in CollisionRayResultCallback (from OgreBulletCollisionsRay.h). As far as I got what Bullet is doing, then it really only needs a start point (Vector3) and a finish point (i.e. aiming point - another Vetor3). So, what's the point of having extra things here?

2) What info exactly can you get from a Ray's collision? Is it just hasCollided() boolean? Any way to get point of contact (Vector3 coordinate), penetration depth even (well things similar you'd get in ODE from Contact() after doing a Ray->collide(whatever...);

3) And finally, just confirm, if I got it all right - a Ray in Bullet is known as CollisionRayResultCallback. In order to cast it (or collide) you do: World->launchRay(ray_pointer). And then the result you get by accessing CollisionRayResultCallback->hasCollided() for instance.

Would be really great if someone could answer that, so I don't have to study all the source, heh :) . Thanks in advance!

Chaster

27-10-2007 12:03:24

Hi Aquatix,

Even though I've contributed some stuff to OgreBullet recently, I haven't had a chance to try out the Ray-casting stuff. I believe that the existing code *might* be a bit buggy, but obviously, I haven't checked it out yet (it's on my to-do list though).

Hopefully, someone else can shed some light...

Chaster

tuan kuranes

01-11-2007 17:57:28

Sorry, seems I missed that one !

1) Ray is there for commodity as Ogre uses ray... but perhaps not that smart, you're right. Patch welcome ! (I'd like to find a way to solve the new/delete at each ray too.)

2) the callback has getCollidedObject() methods besides getpostion, getnormal, and doescollide.

3) in case of single result, yes. Otherwise, I think you have to override it to be notified of each result (hence the callback?). So it's ray + ray results getter.

I committed demo fix so that ray now works correctly.