Scene Graph Collision Scaling

Summary

The scene graph EntityEnteredEvent and EntityExitedEvent do not adjust for scale applied via SetGlobalTransform, KeyFrames, or any other method.

Please select what you are reporting on:

Creative

What Type of Bug are you experiencing?

Assets

Steps to Reproduce

  1. Setup a Verse entity component which listens to EntityEnteredEvent and EntityExitedEvent
  2. At the start of the simulation, scale up the entity via any method including: SetGlobalTransform, SetLocalTransform, or keyframed_movement_component.
  3. Move two entities that use this component to overlap each other.

Expected Result

  • The EntityEnteredEvent is fired when the entities overlap.
  • The EntityExitedEvent is fired when the entities stop overlapping.

Observed Result

EntityEnteredEvent and EntityExitedEvent are fired as if the entity still had it’s original scale. For example, if you have scaled down the entity, the events will trigger a a distance greater than the actual bounds of the entity.

Platform(s)

UEFN, Verse, Scene Graph, PC, Console

Additional Notes

  • If you call mesh_component.Disable() and then mesh_component.Enable(), the entity scales for colission will be adjusted. However, each .Enable() call retriggers an additional EntityEnteredEvent is an overlap is currently occuring. And sometimes a EntityEnteredEvent or EntityExitedEvent may be missed.

I made a video on youtube demonstrating how to recreate it https://youtu.be/8VeLe6H4ILs. And here is the script I used:

using { /Fortnite.com }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Devices/CreativeAnimation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SceneGraph }
using { /UnrealEngine.com/Temporary/SceneGraph/KeyframedMovement }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org }
using { /Verse.org/Assets }
using { /Verse.org/Concurrency }
using { /Verse.org/Native }
using { /Verse.org/Random }
using { /Verse.org/Simulation }

testing_collision_component := class<final_super>(component):


    @editable
    TestingTrigger : trigger_device = trigger_device{}

    var CancelAnimationEvent<protected> : event() = event(){}


    EntityEntered<protected>(MyEntity : entity) : void = 
        Print("Entity Entered Event")

    EntityExited<protected>(MyEntity : entity) : void = 
        Print("Entity Exited Event")



    StartFollowPlayer(MaybeAgent : ?agent) : void = 
        if(Player := player[MaybeAgent?], Player.IsActive[]):
            spawn. FollowPlayer(Player)
    
    FollowPlayer(Player : player)<suspends> : void =
        race:
            CancelAnimationEvent.Await()
            loop:
                if(Player.IsActive[], FC := Player.GetFortCharacter[], FC.IsActive[]):
                    NewTranslation := FC.GetTransform().Translation + vector3{ X := 500.0, Y := 0.0, Z := 0.0 }
                    CurrentTransform := Entity.GetGlobalTransform()
                    Entity.SetGlobalTransform(
                        transform:
                            Translation := NewTranslation
                            Rotation := CurrentTransform.Rotation
                            Scale := CurrentTransform.Scale
                    )
                    

                Sleep(0.15)

    OnBeginSimulation<override>():void =
        (super:)OnBeginSimulation()
        Print("OnBeginSimulation")

        if(MeshComponent := Entity.GetComponent[mesh_component]):
            MeshComponent.EntityEnteredEvent.Subscribe(EntityEntered)
            MeshComponent.EntityExitedEvent.Subscribe(EntityExited)

        ## TESTING ##
        TestingTrigger.TriggeredEvent.Subscribe(StartFollowPlayer)

    OnSimulate<override>()<suspends> : void =
        Print("OnSimulate")
        Sleep(30.0)
        Print("Changing object scale")
        CurrentTransform := Entity.GetGlobalTransform()
        Entity.SetGlobalTransform(
            transform:
                Translation := CurrentTransform.Translation
                Rotation := CurrentTransform.Rotation
                Scale := CurrentTransform.Scale / 5.0
        )
        

    OnEndSimulation<override>():void = 
        Print("On End simulation")

        CancelAnimationEvent.Signal()


1 Like

Hi Gabe,

Thanks for the extra info + video.

Be sure to follow this related bug report too!

FORT-862062 has been added to our ‘To Do’ list. Someone’s been assigned this task.

The bug appears to have been fixed in the most recent update 34.00. Requires confirmation. Thanks for the response @Astrotronic :slight_smile:

1 Like