Add Actor Local Offset on Pawn Creates a Rubberband effect

I am trying to implement movement on a pawn with simulated physics by adding local offset in the X direction. When I play the game in the viewport it starts to go forward but after a time comes to a stop, after releasing the W key it is pulled back towards its original location. Below is the blueprint:

image

These are the collision and physics settings:

I have no idea what is causing this effect, the floor is flat and set to block all objects so I dont think its clipping and creating wonky physics forces. I tried removing all interia/friction but that didnt stop the rubberbanding. Any ideas would be helpful.


Could you try something like this?

1 Like

Recreating that the movement doesnt rubberband anymore but its locked in the X direction and isnt relative to the mesh’s orientation os it can only move along the X world axis. I tried to use Get Actor Forward Vector which kind of works but creates some strange behavior if the mesh gets tilted like being able to fly which shouldnt happen.

I managed to get it working by taking L1z4rD89’s solution and modifying it a bit. There were two issues with their solution.

  1. The velocity was applied along the world X direction and not relative to the front of my pawn.
  2. The Pawn could could fly if it moved up a hill or off a ledge.

To solve the first issue I got the actors forward vector, normalized it and then multiplied it by my speed variable. This created a vector for my speed in the front direction of the pawn.

I initially thought the velocity vector was just high enough in magnitude that it was overpowering the force of gravity creating the ability to fly but in reality I think I was setting the velocity vector which overwrote the velocity applied by gravity. So to do this I broke my speed vector and got the current actor velocity. I created a new vector passing in the X and Y from my speed vector and passing the Z component of my actor velocity. This allowed horizontal movement while allowing gravity to still govern the vertical component. Its still a little floaty (like driving a tank on the moon) but I think that just comes down to tweaking my speed variables.

Here is the blueprint if that was too hard to follow:

As a bonus you can see the simple solution for turning too as I was using Add Actor Local Rotation for turning too and having similar issues.

1 Like