TL;DR
When I move a (static mesh) component of an actor using SetRelativeRotation
or SetRelativeLocation
(or any other similar node), the component is moved, but its collision space is not, unless Auto Weld
is disabled, in which case other issues occur.
See the video link at the end of the question for a demonstration.
Full description
I want to make several interactive objects (e.g., desk drawers, chests) which I build in blueprints as a collection of static mesh components, hierarchically organised in a way that’s analogous to the real world (e.g., chest lid attaches to a rotating hinge, which attaches to the chest body). Relative transformation of components is done in the Actor’s blueprint using SetRelativeTransform/Rotation/Location
when an event occurs (Player blueprint triggers an interact event on the target object).
The movement of the component works fine. However, in its new location/rotation, the component does not register hit events from Line Traces, nor does it block player movement. If Auto weld
is disabled, this works, but this breaks the physics being applied to the movable component.
Here’s a simple yet extreme example that demonstrates the issue.
Two cubes, parent (white) and child (red):
The red cube is the movable component in this example. Movement is handled by the following blueprint:
This receives input from the player blueprint which sends input axes values (mouse movement).
Now, there are two scenarios, each with its own issue.
1 - Auto weld
is enabled on both cubes
In this case, after the player is done interacting with the cube, the shape of the collision of the object does not change. The player can walk through the red cube (in its new location) and cannot walk through the original position of the red cube. This also affects Line Traces.
2 - Auto weld
is disabled on both cubes
In this case, after the player is done interacting with the cube, the shape of the collision does in fact change. However, the disadvantage here is that without the two components welded together, forces applied to the red cube (walking into the cube or shooting it with a projectile) do not affect the object (no force is applied).
How can I get both effects? I want forces on the red cube to register on the whole actor, which I can only get from welding the components, but it’s also important that the collision space of the movable object moves with it.
Here’s a video that demonstrates what I describe above: [YouTube video][3]