Raycasting makes my game crash

esset

06-11-2010 22:41:06

So, as the title says; raycasting crashes the game.

NxOgre::Ray r;
r.mDirection = mMuzzleOrientation;
r.mOrigin = mMuzzlePosition;

NxOgre::RaycastHit hit = Global::Nx->NxScene->raycastClosestShape(r, NxOgre::Enums::ShapesType_Dynamic);
That's the correct way of doing it afaik. The orientation and position are both NxOgre::Vec3's.

Im using VS and im getting NxOgre::PhysXInternalErrorException aswell as NxOgreScene.cpp with lots of uninstanced objects. The line it breaks at is NxShape* nxShape = mScene->raycastClosestShape(inRay, NxShapesType(int(type)), hit, group, maxDistance, hintFlags, 0, cache);

Nothing goes wrong up until i raycast, so everything should be instanced and nice.

All help appreciated, thanks.

esset

07-11-2010 01:08:39

Well i found the error. I managed to use an invalid orientation.

EDIT: If I have my rotation as a quaternion, how do i turn it into a unit vector?