# Player control: position, velocity, or acceleration?

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

## Recommended Posts

Im making a game that involves the player controlling a human character, and am faced with a problem im sure everyone has encountered. When the player hits the "up" key, the character is supposed to move forward. At first, I made it so that if the "up" key is held down, then at every cycle of the game loop, the character's position is moved forward by some amount. It worked fine until i tried to implement physics. For physics, i need velocity and acceleration. When a force is applied, acceleration changes. At every cycle, i update velocity based on acceleration, then update position based on velocity. This, then, is a problem, because the change in position due to the "up" key is not reflected in the velocity. I then thought about having the "up" key adjust velocity, but then that would cause a similar problem between velocity and acceleration. If i make it adjust acceleration, it would involve some weird logic. Anyone know of a good solution? What is the method used in most games? Thanks.

##### Share on other sites

Robert Dunlop - implementing steady montion

and here is a link to my project, so you can take a look how i did it.

##### Share on other sites
oh heh, now it looks so simple. Makes me wonder why i didnt think of doing it that way. Thanks a bunch!

##### Share on other sites
well, the idea is trully simple. but i advice to practice caution. it took me quite some time to get things work the way they should. what's more, i bet you're going to get some phisics and maths books soon to refresh your primary school knowledge. this happened to me ;-)

anyways, good luck with your porject.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 10
• 12
• 10
• 11
• 13
• ### Forum Statistics

• Total Topics
634095
• Total Posts
3015477
×