Thursday, February 27, 2025
spot_img

second prime down motion physics: velocity, max velocity, acceleration, friction, velocity, delta


I’m making a second prime down recreation and am attempting to implement motion. My present method may be very easy and appears like this

motion = (-input.left + enter.proper, -input.up + enter.down)
acceleration = motion * SPEED
velocity += acceleration * dt
velocity *= FRICTION
place += velocity

the place (0

I attempted the same method that appears like this

motion = (-input.left + enter.proper, -input.up + enter.down)
acceleration = motion * SPEED - velocity * FRICTION
velocity += acceleration * dt
place += velocity

the place (0

I’ve tried other ways to implement friction/slowdown however I’m not certain the place I would like to incorporate delta to maintain it constant. Moreover, I’ve tried clamping the up to date velocity to (-MAX_SPEED, MAX_SPEED) earlier than making use of it to the place however that doesn’t appear right because it doesn’t retain the unique magnitude. I perceive that I can test if its magnitude is bigger than the max velocity, normalise it, then scale it by the max velocity however as soon as once more I’m not certain the place to stay in delta to maintain it constant.

How can I design a motion system that comes with a velocity (px/sec), max velocity (px/sec), friction (any type of adjustable slowdown) that behaves the identical throughout totally different replace charges?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest Articles