Ray test Refresh?

JohnBoyManbullet

29-07-2011 04:19:59

Hello all, I have been toiling with rayhits and ray testing, it has driven me nuts for a week. I have figured out what the problem is im pretty sure. I have fomulas for calculating the distance from a ray hit. I have been using this to calculate the hit point and for other purposes. My problem was after the first hit the raycallback.hasHit() will remember that it hit something , and from there onward even if it isnt hitting somthing, it still is set to has hit. This means my calculations remeber the first hit, and will not re calculate because the ray hit didn't refresh it self. This is frusterating, i do not understand. I know that the contactManifold does this to solve a similar situation.



contactManifold->refreshContactPoints(obA->getWorldTransform(), obB->getWorldTransform());




Is there something like this , but for ray tests. I need to refresh them, or just delete the last ray hit. ? any words thanks.

JohnBoyManbullet

29-07-2011 04:43:46

Okay i figured it out. I'm posting this because i have never seen this in any of the demos and it saved my project.


if your using this, in the framerenderingquered or the framestarted of ogre. the ray test may just loop over and over and never update, so i figured you can reset it like this. and it works like a f*cking charm.


if(raycallback.hasHit()){




raycallback.m_collisionObject=0;
}