Raycast to group

independentCreations

19-02-2007 06:48:56

i have modified the ray cast, to allow a group mask. But when i pass in the group id, i no longer get ray cast hits.

---ray cast creation---

Ogre::Ray r = Application::Singleton()->GetCamera()->GetCamera()->getCameraToViewportRay(0.5f, 0.5f);
nxOgre::rayCaster * m_ray_caster = Physics_System::Singleton()->GetScene()->createRayCaster(r.getOrigin(),r.getDirection(), 200.0f);


--ray cast cast---

bool rayCaster::castClose(bool _autoNormalise, NxShapesType shape_type, NxU32 group) {

if (_autoNormalise)
mDirection = mDirection.normalisedCopy();

NxRay mRay(NxTools::convert(mOrigin),NxTools::convert(mDirection));
NxShape *hit = _owner->mScene->raycastClosestShape(mRay,shape_type,mRayCastHit,group,mLength);

if (hit) {

if (mRayCastHit.shape->getActor().userData) {
mHitBody = static_cast<body*>(mRayCastHit.shape->getActor().userData);
mDistance = mRayCastHit.distance;
mHitNormal = NxTools::convert(mRayCastHit.worldNormal);
mHitPos = NxTools::convert(mRayCastHit.worldImpact);
return true;
}
else {
return false;
}
}
else {
return false;
}


}



i have crossed checked the NxOgre and physx group ids and they match up. putting the group mask as 0 (defualt group id) also yeilds no hits. Has anyone had any luck with this? or any other way to ray cast and analize the hits? i also attempted castAllShapes and the NxUserRaycastReport. any ideas ???