CastRay in Opposite Direction
by Matt Huston · in Torque Game Engine · 03/05/2008 (8:13 am) · 2 replies
I am trying to create a castRay in the 'opposite' direction of the camera. However when I multiply endPos *= -1000, the castRay still is cast forward from the players eyes. I need the castray to actually go the opposite direction so it checks what is directly behind the player.
// Get control camera info MatrixF cam; Point3F camPos; conn->getControlCameraTransform(0,&cam); cam.getColumn(3, &camPos); // Extend the camera vector to create an endpoint for our ray Point3F endPos; cam.getColumn(1, &endPos); endPos *= 1000; endPos += camPos; // Collision info. We're going to be running LOS tests and we // don't want to collide with the control object. static U32 losMask = TerrainObjectType | InteriorObjectType | ShapeBaseObjectType | StaticShapeObjectType | StaticRenderedObjectType; control->disableCollision(); RayInfo info; if (gClientContainer.castRay(camPos, endPos, losMask, &info)) ...
About the author
www.atomicbanzai.com
Torque Owner Brian Richardson