Ray casting question

AlexSilverman
Posts: 141
Joined: Mon Jul 02, 2007 5:12 pm

Ray casting question

Post by AlexSilverman »

Hello,

I'm using the btCollisionWorld::rayTest function, and I'm seeing results that lead me to believe that there isn't a proper raytest (ie: colliding an unending ray against the simulation world). Looking at the raytest involved with grabbing an object in the demo suite seems to support this. I've got a workaround (scaling the vector defined by the from and to vectors to a large degree) but I just wanted to make sure there wasn't some function I missed that does this.

Thanks

- Alex
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Ray casting question

Post by Erwin Coumans »

The btCollisionWorld::rayTest is designed as a ray segment test indeed, it requires a start and end point.

Isn't it possible to turn your 'unbounded' ray (from,dir) into a ray segment that fits into this API using (from,to)?
Thanks,
Erwin
AlexSilverman
Posts: 141
Joined: Mon Jul 02, 2007 5:12 pm

Re: Ray casting question

Post by AlexSilverman »

Hi Erwin,

Thanks for the quick reply. It certainly is possible, and in fact it's already done. It was a simple matter of scaling the ray defined by my from and to vectors by the dimension of my world AABB. This worked fine, but another question just now occurred to me. Is there any danger in colliding a segment that extends outside of the world AABB?

Thanks.

- Alex