# Tag Info

## Hot answers tagged movement

2

Let's assume that although it takes time to change our momentum, we're allowed to change our acceleration vector instantaneously. (If we have to model gradually changing acceleration over time, computing the optimal intercept trajectory gets much harder, so I'd argue it's not worth it - the trajectory we'll get this way still has $C_1$ continuity, so it ...

1

An elegant solution popped into my head: The core of it is this code that should run each frame: Vector3 desiredVector = (destination - transform.position).normalized; Vector3 currentVector = body.velocity.normalized; accelerationVector = desiredVector - currentVector; This code picks an acceleration vector that will counteract momentum that is moving us ...

1

So I found out the answer thanks to Zibelas! I forgot to apply moveVector to my movement. //Move the player myBody.velocity = moveVector * moveSpeed;

1

It looks like you want: private void FixedUpdate() { Vector2 position = this.rb2d.position; position.x = position.x + speed * horizontal * Time.deltaTime; position.y = position.y + speed * vertical * Time.deltaTime; rb2d.MovePosition(position); } Note that the operator before speed is a + for addition (we want to add this frame's movement ...

Only top voted, non community-wiki answers of a minimum length are eligible