Rotating Velocity When Physics Object is Rotated

Hey there!

Currently as part of my game, I have a physics-based pawn (a simple static mesh one) that is rotated via blueprint (sometimes as often as one time per tick. When this happens, he continues with linearly his previous velocity. I was wondering if there was a way for the pawn’s velocity to also rotate with the pawn, so that if he was moving forward before rotating he’d still move forward along his new forward vector instead.

If anybody can help with this I would be greatly appreciative!

Yes, you may use AddForce X float X GetActorForward vector…

Use Linear and Angular Damping settings on your physics root to slow the movement (linear) and rotation (angular) after you have done using AddForce, AddTorque, AddImpulse

Pawn physics in UE4 can get complicated (search MMT toolkit by BoredEngineer for an advanced perspective)… things like Tick speed and framerate, physics substepping need to be sorted out for advanced applications that will stay stable on a wide variety of computers. Unless you have a good reason (which is possible), try to bypass physics… because it needs a LOT of adjustment. Instead, as much as you can and use the built-in Pawn (or is it DefaultPawn… I forget) and Character BPs, which handle movement, rotation and collision very efficiently.

yea, I’m having this same problem where the mesh rotates but the actor(aka pawn) doesn’t rotate along with it, so you basically have a mesh that spins around but the actor just sits in one spot. I made it to where i rotate the actor with “AddActorLocalRotation”. This is non-physics based rotation, so i don’t know if that will work for your project. You can’t seem to rotate the actor with physics, only the mesh will spin around in one spot.

Hi there aNorthStar! Thank you for this explanation but I am trying to do something different from what you have explained. I am not simply trying to add a force in the direction of the pawn’s forward vector. What I AM trying to do is make it so that whenever I rotate the pawn, his velocity rotates as well. The “forward vector” thing was just an example. So if the pawn was moving in a direction, and was then rotated, its velocity would head in the same direction relative to the new rotation. I made a really really crude illustration of this concept where the top image represents the pawn’s velocity before rotation and the bottom one represents its velocity after rotation. Thanks!

You should be able to achieve it with Get Linear Velocity first, rotate the vector next as needed and then reapply it with Set Linear Velocity. Just make sure you’re not accumulating force, the Set node has a tickbox for that.

Untested but could work, hopefully the transition is not jarring. Overriding physics states in UE4 can lead to some craziness every now and then…