Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to make sweep work with rotation?

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?


Edit: Some additional information about my setup:

  1. The player's ship is a custom pawn which has a static mesh component as its root component.

  2. The custom pawn's constructor calls "SetActorEnableCollision(true);"

  3. 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.

Product Version: Not Selected
more ▼

asked Apr 16 '15 at 04:48 PM in C++ Programming

avatar image

51 3 8 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Have you looked at the twinStickShooter c++ classes?

more ▼

answered Apr 17 '15 at 02:42 AM

avatar image

242 17 26 35

avatar image Zejji Apr 17 '15 at 01:50 PM

Hi DanaFo - thanks for replying!

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:

  1. Calling "SetCollisionProfileName(UCollisionProfile::Pawn_ProfileName);" on the ship's static mesh component.

  2. Using "RootComponent->MoveComponent(Movement, NewRotation, true, &Hit);" rather than AddActorLocalRotation().

  3. 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).

alt text


collision_bug.jpg (271.0 kB)
avatar image Zejji Apr 17 '15 at 02:24 PM

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

avatar image vle07 Mar 18 '16 at 10:50 PM

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?

avatar image Elathan Oct 17 '16 at 07:49 PM

Still nothing?

avatar image mightyenigma Mar 18 '18 at 06:10 AM

Have they added rotation sweep yet?

avatar image NilsO. Feb 19 '19 at 10:56 AM

Rotation sweep is still not supported in 4.21

avatar image mightyenigma Feb 19 '19 at 04:23 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question