raycast redundancy

Jacky_J
Posts: 16
Joined: Fri May 11, 2007 7:06 am

raycast redundancy

Post by Jacky_J »

isn't it a little redundant to pass the start and end vector twice when you need to raycast the world?

i.e.

Code: Select all

btCollisionWorld::ClosestRayResultCallback Result(Start, End);
PhysicsWorld->getCollisionWorld()->rayTest(Start, End, Result);
I think rayTest() should only have one parameter, ClosestRayResultCallback.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: raycast redundancy

Post by Erwin Coumans »

btCollisionWorld::rayTest accepts various RayResultCallback structures, and you can define your own that doesn't need the ray from/to.

We could remove from/to from the ClosestRayResultCallback, it is just a convenience thing.

We can add some examples for btCollisionWorld::rayTest to calculate _all_ hits, and to calculate the first (not necessary closest) hit, without the need to add from/to twice.

Hope this helps,
Erwin