Announcement

Collapse
No announcement yet.

SetActorLocation during Event EndActorOverlap causes unexpected high momentum in Actor. Bug?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    SetActorLocation during Event EndActorOverlap causes unexpected high momentum in Actor. Bug?

    Just as the title says, my goal is to create a boundary which the player resides in and cannot leave.
    In order to do this, I created an actor that has a box collision. The collision is set to OVERLAP ONLY.
    The actor is placed inside the box. When the actor leaves the box collision, I constrain its position to the edges of the box's extent. So let's say the box extent goes to X=300. If the actor starts at 0,0,0 and moves to position 302, I reset its location to 300. This happens similarly for the Y and Z axis, effectively trapping the actor within the box. The actor should "stick" to the edge of the collision, and works fine while doing this during Tick.

    I originally did this logic during event Tick, but due to the FUD against using Tick, especially since the code gets called when we're freely moving inside the box, I decided to try calling this code only during EndActorOverlap.
    However, I've discovered that when SetActorLocation is called during the event EndActorOverlap, the actor has a ton of momentum or force applied to it out of nowhere. The actor can have so much force applied, that it flings itself to the other side of the collision bounds and bounces off the edge. This can happen a few times. I don't have physics turned on, and calling the same code from Event Tick instead shows zero problems! So it's not a problem with the concept of what I'm doing... the engine is perfectly fine doing this during Tick.

    Additionally, I can scale back the concept even more... if during EndActorOverlap I set the Actor's position to 0,0,0... the center of the box.... the physics issue STILL happens. I can also set the position to very far OUTSIDE the box, and the actor still has this force applied.. so much so it'll fly off 60,000+ units away. So it's not an issue with the actor "being on the edge of overlapping and not overlapping" and it's not an issue with "the actor stops overlapping but then immediately starts overlapping again"... Either way, it works during Tick!

    My last thought is, maybe ActorEndOverlap is called during a bad time in physics, and maybe I can set Event Tick to mimic this behavior. I've set the actor's Tick group to Pre, During, Post, and Post-Update and all of them work perfectly fine! I can't even make Tick behave the same as EndActorOverlap.

    A few event problems like this have happened to me, which I could "hack" by adding a Delay 0 node to them. When I do my "Clamp Pawn Position To Bounds" logic during EndActorOverlap, and after a Delay node, then the behavior is fairly close to what I want/expect.. the momentum is still being applied, but to a much lesser degree. This causes the actor to "bounce" against the side of the box collision instead of "stick" to it... closer to what I want, and less of a problem.. but definitely not the expected or DESIRED outcome.

    At this point, this definitely seems like a bug... definitely unexpected behavior.

    I've made a new project with the bare essentials in order to show off this problem. I started a new blank project, made a simple pawn and an actor for the player boundary, and set the camera to look down into this area. Please open the PlayerBounds event graph and switch the logic between Event ActorEndOverlap and Event Tick to see the results.
    https://www.dropbox.com/s/tllhnkc4t3...inBox.zip?dl=0

    Tick event is king. Stop bad mouthing Tick.
    Last edited by MasterEvilAce; 05-28-2019, 10:18 AM.

    #2
    Why not use Block instead of Overlap, then you do not need to manage his leaving your desired area? You can create 4 boxes around him.
    SolidGasGames

    Comment


      #3
      Did you set Teleport to True on the SetActorLocation node?

      Comment


        #4
        Telimaktar, while doable, it's not a great solution as you can't make that work with other scenarios... say a circle/sphere. It also adds more complexity in that you have to handle 6 collision objects and manage their sizes, instead of just one.

        DsyD, neither Sweep nor Teleport have any effect... the behavior is the same as described.

        Comment


          #5
          Try disabling the collision before you move the pawn then switch it on afterward.
          SolidGasGames

          Comment


            #6
            Interesting idea, but disabling collision and re-enabling after the move does not change anything. The pawn still freaks out and flies off the map.

            Comment

            Working...
            X