Applying physics force and rotating actor simultaneously causing strange movement

Background:
When developing a game to have a physics enabled rocket actor orbit around a fixed planet I ran into an issue with physics acting strangely when the rockets rotation was being set at the same time that the planet was applying a gravity force to the rocket. I narrowed the issue to the actor having a simultaneous physics force applied and rotation being set.

Reproducing Bug:

  1. Create default project.
  2. Add a new actor blueprint to the project and add a mesh component to the actor blueprint. (I used a cube)
  3. Set the new actor to have physics enabled and gravity disabled. With or without gravity the issue persists.
  4. Add a new actor-component blueprint to the project which will add force to the physics enabled actor. I have attached the text of my blueprint for AddForce.
  5. Add a new actor-component blueprint to the project which will rotate the actor. I have also attached the text of my blueprint for RotateActor.
  6. Add the AddForce and RotateActor blueprints as components of the actor.
  7. Run the project in editor mode. The actor mesh will rotate correctly and the actor velocity will be calculated correctly but the position of the actor will update in an irregular fashion.
  8. NOTE: If using my AddForce and RotateActor blueprints, add a tag to the actor named Mesh so that these blueprints can get the primitive component of the mesh

If needed I can provide a of the project file.

Information:
Issue occurs in Unreal Engine 4.16.3 on Windows 10.

Hello BimmyBimmy,

The file you uploaded seems to be empty, at least from what I see. Could you upload a of the project itself for quicker testing?

Hi Matthew, my apologies for the original being empty! I’ve put together an example project that better illustrates the issue and attached it here. In this project I have set five actor cubes with physics enabled and gravity disabled to have a force applied to them in the positive x direction and to add a local actor rotation. I have used different methods to apply the force and to rotate each actor.
The results from this testing are as follows:

  • Actors with physics enabled and with scene components cannot be rotated by any AddRotation function, whether it targets the actor or the scene component, or if the rotation is local, relative, or world based. I assume this is intended functionality as with physics disabled, AddActorLocalRotation works as expected.
  • Actors without scene component and with force and rotation added by actor components update position in a very irregular fashion.
  • Actors instantiated as a default static mesh cube without a scene component and with force and rotation set by actor components update position and rotation nearly correctly, however they move slightly slower than an actor instantiated from blueprint, whether the blueprint instantiated actor has a scene component or not, or if the force of the blueprint instantiated actor is applied by a function in the event graph or by an actor component.
  • Actors without scene components and with force and rotation added by functions in event graph update position and rotation as expected.

Notes:
Best practice with this use case is probably to set the rotation of the actor as a physics angular velocity rather than adding a local rotation to the actor every tick. As well, I am uncertain whether it is best practice to have an actor with its root as a mesh (e.g. without a scene component) as this is the only case where the issues can occur.

Thank you for your time!

link text

Hello BimmyBimmy,

I apologize for the delay but thank you for providing the reproduction project. I’ve taken a look and entered a bug report for this which you can find here: UE-52519 You can follow that link for any updates to the bug report, but as this issue has been around for a while, it will likely not be prioritized or fixed soon.

Have a nice day!

Experiencing this problem as well.

Also experiencing this issue. I was applying forces with AddForce every Tick. But the moment I added a .SetActorRotation() in order to make them face their velocity, the simulation broke. It only worked when the framerate was low enough for substepping to occur, if that gives anyone more information to look into. Very odd, but regardless, I’m going to try AddTorque instead since I suppose it’s a bit odd to set rotation directly of a simulating actor. Epic please fix!

Hey Matthew, Thanks for registering this bug! Am I reading this right though? It’s already been marked as “Won’t Fix”? There’s no explanation either or response. Seems like a pretty big bug to me, or at least one that deserves some response or reasoning. Any details? Thanks!

Hello ELKatlan,

I checked the comments on the bug report itself and added a public note to the public report to give an explanation. It was decided by the developer in charge of that area that we will not allocating resources to fixing this. The comment I provided was “We will not have a chance to dig into this. My guess is it is related to forces being added in different orders, and the ‘set rotation’ cancelling out velocity (being treated as a teleport)”

It may be possible to work around this by ensuring that the velocity is kept after set rotation. Unfortunately I’m not sure how else to assist.