I’m getting very inconsistent behavior with “Sweep” movements.
With a sliding door, if I move it repeatedly with AddRelativeLocation with Sweep=True, door stops when it hits an obstacle. This is great.
With a rotating door, if I move it repeatedly with AddRelativeRotation with Sweep=True, door passes through all obstacles. This is not great.
StaticMeshComponent that I’m moving has good collision volumes, has collisions turned on, and in all other ways seems capable of blocking or being-blocked. I can make it collide with static or dynamic objects (or both) by tweaking its collision settings, and that all seems to work fine for most things. But when motion is rotation, Sweep seems to do nothing.
Create a new “First Person Blueprint” project in UE4.4.1, and use Example_Map level.
Delete several physics-objects blocks in Example_Map, to avoid confusion.
Create a new Blueprint, derived from Actor, called “MovingBlock”
In that Blueprint, add a StaticMeshComponent called Block. Set Block’s StaticMesh to Shape_Cube asset, set its Collision Presets to “BlockAll”.
In that Blueprint’s EventGraph, add an EventTick which calls AddRelativeLocation (Target=Block, [X=10, Y=0, Z=0], Sweep=True). This will make it slide in +X direction continuously.
Drop an instance of that blueprint into middle of ExampleMap arena.
Hit Simulate, and watch how block slides and then stops when it hits a wall. This is “good” behavior.
Now modify EventGraph so that EventTick instead calls AddRelativeRotation(Target=Block, ([R=0, P=0, Y=1], Sweep=True). This will make it Yaw (rotate around Z axis) continuously.
Move Blueprint instance so it’s next to (but not touching) one of Example_Map walls.
Hit Simulate, and watch how block rotates through wall. This is “bad” behavior.
Why does Sweep cause AddRelativeLocation to stop on collision, but not AddRelativeRotation?
Thanks for thorough investigation! I was able to reproduce issue you described, and have entered a report in our database for our developers (TTP# 346402). I will let you know when I see an update on this. Thanks!
Unfortunately you are correct: rotational sweeping isn’t supported. bug report (UE-3158) was closed because developers aren’t able to fix this with current collision/physics system. I’m going to see if they can at least remove Sweep option from node as it clearly doesn’t belong there.
What a shame, for a moment I thought you guys would fix/support this, and that would have solved all coll issues I’ve been struggling with for several weeks
Out of curiosity, would you be so kind as to ask for an explanation on why it wouldn’t be supported ?
Thanks
Sweeping shapes is a pretty well understood problem and there are good analytic solutions to it, but (as far as I know!) that just isn’t case for rotation. only approaches I know of involve something like binary searching, or using some more complex geometries like Plucker co-ordinates, but even then it is very complex and thus slow. If you find an approach that seems practice do let us know though!
only approaches I know of involve something like binary searching PayGoOnline, or using some more complex geometries like Plucker co-ordinates, but even then it is very complex and thus slow.
IDK - you could try jiggling it a tiny bit each time it rotates, using a SetActorLocation node, with sweep added, to force it to collide. Not sure if that works though.
I’m currently working on a custom movement system that runs up against this issue. There are ways around it, but cost starts to become a concern. I’m curious how this type of thing is handled on objects simulating physics, which are bound to collide from rotations. Do they just enter from a rotation then depenetrate up to a max iteration?