More trig questions!!!
I have a 3d object with yaw, pitch and roll properties. I need to make the object fly forward in which ever direction it is pointing. how do I do this?
Example:
ship.position.x+= cos(Ship.angle*piover180)*ship.speed;
ship.position.y+= sin(Ship.angle*piover180)*ship.speed;
That should work for 2d, You''ll probably manage to solve out this for a 3d system yourself, and add the yaw, pitch and all that stuff as well yourself.
Kenneth Wilhelmsen
Try my little 3D Engine project, and mail me the FPS. WEngine
Or just visit my site
--------------------------
He who joyfully marches to music in rank and file has already earned my contempt. He has
been given a large brain by mistake, since for him the spinal cord would fully suffice. This
disgrace to civilization should be done away with at once. Heroism at command, senseless
brutality, deplorable love-of-country stance, how violently I hate all this, how despicable and ignoble war is; I would rather be torn to shreds than be a part of so base an action! It is my conviction that killing under the cloak of war is nothing but an act of murder
ship.position.x+= cos(Ship.angle*piover180)*ship.speed;
ship.position.y+= sin(Ship.angle*piover180)*ship.speed;
That should work for 2d, You''ll probably manage to solve out this for a 3d system yourself, and add the yaw, pitch and all that stuff as well yourself.
Kenneth Wilhelmsen
Try my little 3D Engine project, and mail me the FPS. WEngine
Or just visit my site
--------------------------
He who joyfully marches to music in rank and file has already earned my contempt. He has
been given a large brain by mistake, since for him the spinal cord would fully suffice. This
disgrace to civilization should be done away with at once. Heroism at command, senseless
brutality, deplorable love-of-country stance, how violently I hate all this, how despicable and ignoble war is; I would rather be torn to shreds than be a part of so base an action! It is my conviction that killing under the cloak of war is nothing but an act of murder
Its so simple for 2D! thats because there is only 1 plane
Actually I just multiplied a vector pointing in the direction of the ship by the rotation matrix![](wink.gif)
I still need to use all these angles when I calculate the ''visibility'' from each gun turret. I will have to do some more exparamenting
Actually I just multiplied a vector pointing in the direction of the ship by the rotation matrix
![](wink.gif)
I still need to use all these angles when I calculate the ''visibility'' from each gun turret. I will have to do some more exparamenting
For visibility use the dot product to determine if the angle between the direction vector of the turret and the Turret-Target vector is less than half the turret''s FOV.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement