At this point I think its probably a bug, but hopefully I am doing something wrong.
To simplify the problem lets say I am trying to rotate object towards its velocity:
So in the blueprint it works without problems: place that actor in level and shoot it, it always faces the velocity direction
But when I try to create an actor/scene component so that I can make the behavior reusable, it breaks and and creates problems, especially with location.
To replicate
Create actor/scene component and create a variable of PrimitiveComponent reference to get velocity and set rotation
Apply this scene component to the same cube and set comp reference to the cube in constructor
Place it in level and apply force to see results - rotation jittery, location not updating
The conclusion I am drawing is that when setting rotation of physics simulated component from blueprint it works fine, but when doing the same from actor/scene component it messes up.
I wanted to give you an update. I’ve spent a little bit of time with this today and while I’m seeing different behavior between the BP component and the BP that includes this setup I’m still looking into it just a bit before reporting a bug.
I’m going to reach out to our BP team to double check a couple of things.
As a workaround for the moment, you can actually use a Macro that can be used in any actors of any classes.
All you need to use this macros is to setup a macros library BP ([documentation][1]).
When you create this Macro library you can just set it up like this:
Thanks for following up ! I resolved my issue by applying physics torque on the referenced Primitive Component instead of setting its rotation. This was by design a better thing to do anyways so I am not directly blocked by this anymore. But as such the problem remains. Imagine you design a “compass” component which rotates an X axis of a mesh to North all the time, and you need to pass the reference of that mesh that needs to be rotated. This would genuinely be an issue. Additionally, I logged the speed of the target object in the console and I was surprised to see it increasing/decreasing correctly after it received an impulse. It almost creates a feeling that the only missing thing is the location to correctly update. Bottom line, setting rotation on a reference of Primitive component through an Actor/Scene component definitely bugs its location, and I would be happy to see this fixed. Thanks again and good luck!
I’ve been trying to get this setup in a fresh project and am having difficulty getting things to work the way I had before since I’ve lost or gotten rid of the previous project that had this setup.
Would you mind uploading a simple setup with just the cubes and this that I can submit a ticket for.
You bet! No hurry to fix it, I have resolved it by using a different and more appropriate technique. I have uploaded a sample project to mediafire and dropbox, use whichever link best suits you. Here are the links: Dropbox Mediafire
SetRelativeRotation is causing a similar Physics issue as well in 4.13. Checking or unchecking Teleport has not effect. Object bounces around. Removing just this BP item causes the, in my case, Blueprint Static Mesh actor with Physics enabled to not behave properly.
According to the bug report here, this was marked as “Won’t Fix”. Check your velocity to ensure that it is not registering as 0, it may be pulling velocity from a component that doesn’t have physics enabled on itself, which could cause this error to occur.