Advertisement

Shooting an enemy

Started by April 14, 2001 06:57 AM
1 comment, last by vibi 23 years, 10 months ago
I am trying to implement a First person shooter in OpenGL. I am having trouble figuring out how to locate the position of an object after transformations? In other words, after the user moves around in the world by hitting the arrow keys how do I figure the new positions of objects in the world? Thanks in advance. Vibi
what i did in DX is to have a few variables to keep track of where the user is, so every time the usermoved, it would change the variables (x, y, z, direction) in addition to doing the transformations and then you can just look at these vars to find out where the user is.

for the transforms i had all the meshes at a certian point ( i think at (0,0,0)), and transformed them every frame i accordance to the variable mentioned above every frame. This probably isn''t the ideal way of doing this, but it does work (speed wasn''t really a concern to me, it was just a simple demo i made so i could get used to DX).

hope this helps
Advertisement
Thanks wingman for replying.

How do you store the rotations? Do you get the glModelView matrix and multiply it? I am thinking of using your method. It seems straightforward.

I can''t seem to determine the user position if the user moves at an angle.

This topic is closed to new replies.

Advertisement