PDA

View Full Version : Novodex Raycastin Woe's


jonj
02-24-2006, 11:51 AM
Hi,

I'm trying to do some raycasting in Novodex, so I can make the cube I click on with the mouse the selected actor. I'm using DirectX, specifically Direct Input to get the mouse position (x,y,x). Then my camera uses camerapoistion to specify position and PointCamera as the vector where the camera is pointing. I know I probably need to use the Pointcamera somehow, possibly through DX3DMatrixLookAtH.

Please can anyone point me in the right direction, or show me some code that already has it working, my deadlines approaching .... Thanks Jon

orig = NxVec3(camerapoistion.x, camerapoistion.y, camerapoistion.z);
dir = NxVec3(mousepoisition.x, mousepoisition.y, mousepoisition .z );
NxRay ray(orig, dir);

NxShape* closestShape = gScene->raycastClosestShape(ray, NX_ALL_SHAPES, hit);
if (closestShape)
{
gSelectedActor[0] = closestShape->getActor();