# Free moving objects, my head hurts :(

This topic is 3984 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, I'm fairly new to game programing and I'm having trouble understanding something. I made a simple program which shows our solar system, with planets orbiting the sun. This wasn't too difficult, since each planet has a fixed point of rotation (the sun). Well now I'm trying to create a space ship which can be flown around the planets, I don't want the camera to move with the ship. The ship must be able move in a straight line forwards or backwards (ie. no need for strafing) and turn to face any direction. I guess to achieve this I need to figure out the new coordinates of the ship after every time it has moved (so that it doesn't end up pivoting around the same point) but I haven't the first idea where to start with this. Ive been Googling it for ages now :( Could someone throw me a bone??

##### Share on other sites
Euler integration.

##### Share on other sites
Quote:
 Original post by ZahlmanEuler integration.

And linear motion. More specifically in pseudo-code (I split up velocity into a vector component and a scalar component for simplicity):

// current position and orientation of ship in global framevec3 origin, heading;// current speed of ship in units/secondsfloat speed;// time passed between two consecutive frames of animation in secondsfloat dt;origin += heading * speed * dt;// re-orient heading vector (and potentially normalize), alter speed, etc.SteerShip();// render ship at its new origin, looking at its new headingRenderShip();// and loop

EDIT: The link at the top is just me googling for linear motion. The term is correct, but there most certainly are sources that explain these equations better.

1. 1
2. 2
3. 3
4. 4
Rutin
13
5. 5

• 26
• 10
• 9
• 9
• 11
• ### Forum Statistics

• Total Topics
633694
• Total Posts
3013373
×

## Important Information

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!