rayTest direction

mirswith
Posts: 2
Joined: Wed Nov 23, 2011 2:20 am

rayTest direction

Post by mirswith »

Hi, this is my first post and I am an absolute bullet beginner but am really enjoying my time with bullet so far. :)

I am wondering is there a way to have rayTest return hits from inside objects? For example, lets say I have a btSphereShape in my world and I do a rayTest where the start ray is at that spheres center and the end ray is at some point beyond that sphere's radius. For me this does not generate a collision, it will however if I flip the from & to ray points.

The next question to that is, what if my ray starts and ends somewhere within the sphere... shouldn't that also generate a hit?

I am using a ClosestRayResultCallback to get the test results; have looked at the other result callback classes and the filter/mask properties but with such limited knowledge of this engine so far I am at a loss.

Thanks.

-=ben
User avatar
Kai
Posts: 1
Joined: Tue Nov 22, 2011 4:37 pm

Re: rayTest direction

Post by Kai »

Hi,

Right, a raycast return a hit only when the ray go in the collision object.
If the raycast begins and ends in the body, there is not hit.
Why do you use the raycast?
Can you replace it by another solution ?
mirswith
Posts: 2
Joined: Wed Nov 23, 2011 2:20 am

Re: rayTest direction

Post by mirswith »

I am using it for user picking, however I have a unique situation where the user is always inside of a sphere and I want to detect where on the sphere they touched (assuming nothing was hit before the sphere). I understand I could special case this and do the sphere test if nothing else was hit in which case reverse my ray but this seems a bit unreliable as there could be an object outside of my sphere that was facing away from me that gets the hit unexpectedly.

Any ideas?

Thanks.
-=ben