As noted in this bug report, sweep doesn’t work when using AddRelativeRotation, despite working just fine with AddRelativeLocation. (Just for the sake of clarity, I am using C++, rather than Blueprints, but I experience the same problem described in the bug report. I have of course set the sweep argument to true when calling these functions.) In my game, this bug leads to the player’s spaceship rotating through collision objects which are meant to block.
As of 16 April 2015 (i.e. over 6 months later), this bug doesn’t appear to have been fixed and no update has been given as to when this is likely to happen. It therefore looks likely that I will need to solve the problem in some other way.
As mentioned above, I need to prevent a spaceship rotating through collision objects which are meant to block. Does anyone have any suggestions/workarounds as to how this might be achieved?
Thanks!
Edit: Some additional information about my setup:
The player’s ship is a custom pawn which has a static mesh component as its root component.
The custom pawn’s constructor calls “SetActorEnableCollision(true);”
The objects which the ship should be blocked by are static mesh actors which use a collision proxy made up of a number of convex hull collision meshes.
I read through the TwinStickShooter C++ code and tried using similar code in my own project, but the ship is still able to rotate through the collision objects which are meant to block it. Even worse, I discovered that rotating a collision mesh into another collision mesh does not even register a collision hit, so I can’t even respond to it using bespoke code! It seems as if collision detection is completely absent upon rotation…
Specifically, I tried all of the following, none of which made any difference:
Calling “SetCollisionProfileName(UCollisionProfile::Pawn_ProfileName);” on the ship’s static mesh component.
Using “RootComponent->MoveComponent(Movement, NewRotation, true, &Hit);” rather than AddActorLocalRotation().
Adding code to respond to a hit by moving the ship away from the hit object in the case of a hit. As mentioned above, Unreal does not even register a hit when the collision occurs as a result of rotation rather than movement.
I’ve also attached a screenshot showing an example of the problem (with “show COLLISION” enabled in the console).
Hmm… it looks increasingly likely that this problem is impossible to fix until Epic fix various bugs re rotation of collision meshes. I just noticed this post which highlights a very similar problem. Hopefully it gets fixed soon - I’m just surprised Epic overlooked such a major bug as not having any collision detection on rotation. :-S
I’m also getting this rotation bug. In my case, I’m using AddActorLocalRotation with sweep, but my pawn is still penetrating through objects. When rotating back out of the wall, the pawn will actually pop out of the wall so there won’t be any penetration. It might have something to do with the angle of the rotation. Seems like there’s some sort of collision calculations occurring, but it just doesn’t work well. Have you figured out how to get around this?
May have to create your own solution.
If your pawn uses sphere collision then no rotation sweep is necessary since a sphere has no concave structures protruding from the main body.
If your pawn uses any other shape then maybe you could do something like adding an Overlap-Only component that rotates ahead of the colliding component by one predictive rotation amount per tick, and reports back if it overlapped anything before the real collider would have hit, and you can handle the same logic as if it was triggered by a Hit.
Found a workaround for it:
Set the tick or a ticking component to call the “Wake rigid body” function passing it the rotating mesh as the argument. Set the ticking interval accordingly to the desired precision of the workaround.
P.S. It should be Epic’s priority to fix this bug and not have it’s customers waste time finding ways to make their broken system work.
+1 Bump… Anyone know if using Set-Actor-Transform with its node SWEEP option enabled helps? Or is better in some versions of UE4 / UE5? Its such a strange bug. Workarounds are possible with physics movement / collision. But that’s not practical / workable for everything.
it’s 2024 and the issue is still present. I have an enemy with a rotating ring-like attack and the overlaps with the player are really inconsistent. sometimes they trigger and sometimes they don’t. Have not yet tried any of the solutions mentioned above but will do and update the post. EPIC, please fix this…
To code around this bug (think high-quality reliable solution that works every time and covers all the edge-cases) requires significant investment / resources. Often its easier to just switch to physics (movement). But that has big implications for performance and multiplayer…
I am experimenting with the new Mover plugin to see if a quadruped main character can be done(with correct collisions).
I have managed to add gravity and input movement with WASD but I havent reached collisions.
Anyway the answer is probably - and will likely always be - “no”.
However, a Quadruped is a really poor example since it works just fine with regular capsule collision and movement components.
Inclusing for rotations when using character.
Try something like a Fish which absolutely needs to be able to have its collision oriented to its body in order to fit through objects while moving in a “flying” like state - where direction also really matters.
Still.
I dont really see how the intial issue reported here about rotation not activating sweep checks affects anything at all for character-movement/quadrupeds.
Whereas, try rotating around and finding what you are colliding on as a fish that uses a custom movement component…
You might be right that you can aproximate a quadruped with a horizontal capsule(thats why I will use Mover becouse it lets you use any collisions even if they are not a upright capsule)
but my quadruped also will also fly(edit: also climping slopes/stairs and rotating in its place), so its something like the fish you where saying.
I thoght on a solution of making the character(Edit: pawn with Mover) have 2 collision spheres (one for the back and another for the front) so now rotation is just a moving one shpere. This is theoreticaly posible with Mover but I havent test it yet.
Edit: sorry for the spelling errors, I am not native english
If you really want to use the character, you just add your own collider and base input responses off that collider.
So in essence you have a filter that prevents forward motion being applied if collision on the custom component in the shape you want has occurred.
Its not that hard to do, but it isn’t optimal. A system that lets you orient the peimitive used for detection in the first place is going to be far better in the end - and possibly better for replication…
I dont want to use a player character as a base class becouse I need custom movement mode,(another point for Mover). Also becouse as you say the solutions with character class are hacky and/or not performant.
Also the final objective is to make it multiplayer.
Ps I never said I wanted to use character class quite the contrary, I want to use Mover(Pawn)
hi i have the same problem but my project already 80% finished however i have this bag too ofc i have a long body space ship i just recently started to trying to find a fix .
my solution would be line trace box on whole body of object and registration of the hit and connecting it to movement side left or right .if its rotates left and gets block than it means rotation to left not allowed ,if its rotates right and gets block its means rotation right not allowed . same can be done with rotating up and down . i poste it here when i achieve something . my solution now in scratch state just started it today .