Reputation: 81
Im building a game where the node will move either up down left or right on the screen.
To do this im applying a velocity in whichever direction the person swipes. The issue here is that as the node moves along it's speed gradually reduces.
The main thing im trying to do is to have the node move at a constant speed in whichever direction its currently moving. is there a way i can stop the velocity from decreasing over time or possibly another way of moving the node at a constant speed?
Upvotes: 1
Views: 571
Reputation: 9777
You need to set the physics body's linearDamping
to 0
.
The linear damping is meant to simulate friction, and reduces the velocity of a physics body over time. The default value is 0.1
.
Upvotes: 4