Is casting a radius 0 sphere meant to be the same as casting a ray? I recently switched to using sphere cast, in order to generalise my wrapper ray function from ray(src,dest) to ray(src,dest,radius)
My code looks like the CCD sphere casting stuff in btDiscreteDynamicsWorld.
However all my vehicles stopped working. Other rays worked, but the vehicles sank into the floor as if the returned distance was less than it ought to have been. I haven't looked in detail at why it didn't work. Vehicles can be pretty fragile compared to my other usages of rays.
My solution was just to add a test, where if the radius is 0, I use a ray, otherwise I cast a sphere. Are they meant to be the same for 0 radius?
(I also tried with a very small but non-zero radius, it didn't make a difference)
thanks
Sphere cast vs ray cast
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
-
- Posts: 229
- Joined: Sun Sep 30, 2007 7:58 am
Re: Sphere cast vs ray cast
Hi,
i assume the float precision is simply to low to get proper collision with near zero scale.
i assume the float precision is simply to low to get proper collision with near zero scale.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Sphere cast vs ray cast
It should be that same. Casting a ray is implemented by casting a sphere of radius 0.Is casting a radius 0 sphere meant to be the same as casting a ray?
The only difference is that rayTest only interpolates the translational part between start/end transform, whereas convexSweepTest also interpolates the rotational part. Can you reproduce this problem in the Bullet/Demos/VehicleDemo?
Thanks,
Erwin
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: Sphere cast vs ray cast
Haven't got around to reproducing with the bullet demo yet, but in my own application, I can't get convex sphere casts of radius 0 to return any results at all...