Reproducible Bug: SetRelativeLocation on a component sets the world location if the component is simulating physics

I have a skeletal mesh that is parented to a Scene component in an actor blueprint:

109013-cap3123213ture.png

My skeletal mesh component is set to not simulate physics, and I call its SetRelativeLocation(AndRotation) with all zeros every tick for this actor. I have a key press set up to toggle the component’s physics simulation. The actor it belongs to is at a non-zero world location. When I run my game, the skeletal mesh is where it is supposed to be, sharing the location of the owning actor. When I press my key that toggles whether we are simulating the skeletal mesh’s physics, the component teleports to world location 0,0,0. If I press my toggle key again to turn physics simulation off, the component does not return to relative location 0,0,0, but rather stays at the world origin.

I am able to reproduce this in a fresh 4.12 project, using a Static mesh instead of a skeletal mesh this time. Here is my blueprint for the actor:

Here’s a link to my test project: https://drive.google.com/file/d/0B3u_hzolRrMjdXNiMUc3LW1PbHM/view?usp=sharing

Please let me know if you’d like any more information about my setup.

I’ve added a test project in the description in which I’ve been able to reproduce this issue.

Hey janimationd,

This is actually by design. The reason is that any object that simulates physics will detach from its parent. Physics simulation takes space in World Space, which is why it would set the world location of the object.

Have a great day

Huh, that’s interesting. After this occurs, does the object retain any reference to its parent object? If I turn physics back off for the object it doesn’t snap back to its parent object reference frame.

I believe this is intended as well as it detaches from the parent upon simulating physics. Might be worth trying to reattach it after disabling simulate physics using something like an AttachTo(), but this could potentially lead to some undesirable behavior.

I mean, I can understand not wanting to deal with parenting when you’re also simulating physics – there are conflicting assumptions about how those should work. But if you don’t want to allow it… you shouldn’t allow it. It’s confusing to allow two features to be used together if you’re just going to (permanently?) break one of the features when it happens, especially since this doesn’t seem to be documented anywhere. Why not throw an error instead?

Also, I’m hitting an issue where I have a parent component with physics, and when I try to attach a child component to it and set the child’s relative location, the child’s absolute location is set instead. Is that a related bug?