Calculating the position of an object with regards to current position using OpenGL like matrices
- by spartan2417
i have a 1st person camera that collides with walls, i also have a small sphere in front of my camera denoted by the camera position plus the distance ahead. I cannot get the postion of the sphere but i have the position of my camera.
e.g.
i need to find the position of the point or at the very least find away of calculating the position using the camera positions.
code:
static Float P_z = 0;
P_z = -15;
PushMatrix();
LoadMatrix(&Inv);
Material(SCEGU_AMBIENT, 0x00000066);
TranslateXYZ(0,0,P_z);
ScaleXYZ(0.1f,0.1f,0.1f);
pointer.Render();
PopMatrix();
where Inv is the camera positions (Inv.w.x,Inv.w.z), pointer is the sphere.