RayCastHit : good actor, invalid mWorldImpact

jams

25-09-2007 14:37:50

Hi, I'm using RayCaster class to do some intersection tests, and it seems to work properly at first sight. The actor returned in the RayCastHit is good, but the value of mWorldImpact is wrong (x=1.742e-039#DEN y=1.742e-039#DEN z=-8.1367697e-021).
Any clue on this issue ?

jams

27-09-2007 18:15:34

I come back with that issue, here is what my code looks like :
rayCaster = new NxOgre::RayCaster(Ogre::Vector3::ZERO, Ogre::Vector3::UNIT_Z, 1000.f, NxOgre::RayCaster::RCT_CLOSEST, mScene);

Ogre::Ray ray = camera->getCameraToViewportRay(x, y);

rayCaster->setOrigin(ray.getOrigin());
rayCaster->setDirection(ray.getDirection().normalisedCopy());
rayCaster->setMaxDistance(1000.f);

if(rayCaster->castShape(NxOgre::RayCaster::AF_NONE))
{
NxOgre::RayCastHit* rayhit = rayCaster->getClosestRaycastHit();

Ogre::SceneNode* node = sceneManager()->createSceneNode();
node->setPosition(rayhit->mWorldImpact);
}
Don't bother with pointers, this is not the complete code. So if I look at mWorldImpact, the coordinates are invalid. And now, even the actor seems to be invalid, it crashes if I try getName on it :(
[edit]
I've just done more tests, actually the actor is valid, I just cannot retrieve its name.