Calculating the position of an object with regards to current position using OpenGL like matrices

Posted by spartan2417 on Game Development See other posts from Game Development or by spartan2417
Published on 2012-11-13T13:55:47Z Indexed on 2012/11/13 17:19 UTC
Read the original article Hit count: 321

Filed under:
|
|

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. enter image description here

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.

© Game Development or respective owner

Related posts about collision-detection

Related posts about math