Using SetMesh on a prop with FortPhysics stops physics from working on the prop

Summary

Using SetMesh on a prop with FortPhysics stops physics from working on the prop

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

  1. Place a prop with physics
  2. Use SetMesh() on the prop to change the static mesh

Expected Result

Mesh changes and physics continues

Observed Result

Mesh changes and falls through the floor

Platform(s)

All

Hey @TrickTyger would you mind to share the relevant Verse scripts and also a video if you have time? Thanks.

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

hey, i’ve got a couple of videos - the first changing the mesh, the second without

verse code is this, I just comment out these 4 lines

        BallInt:=GetRandomInt(0,2)
        if. BallInt = 0 then NewBall.SetMesh(Owl_asset)
        if. BallInt = 1 then NewBall.SetMesh(Vulture_asset)
        if. BallInt = 2 then NewBall.SetMesh(Rooster_asset)

They’re no longer falling through the floor since this update but they still don’t react to impulse

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

cannon_component<public> := class<final_super>(component):

    @editable
    InputTrig : input_trigger_device = input_trigger_device{}

    @editable
    BallProp : []creative_prop_asset = array{}

    SpawnBall(Agent:agent)<suspends>:void=
        StartLoc := Entity.GetGlobalTransform()
        if(Prop:=BallProp[0]):
            NewBall := SpawnProp(Prop, FromTransform(StartLoc))(0)
            spawn. FireBall(NewBall, Agent, StartLoc)

    FireBall(mNewBall:?creative_prop, Agent:agent, StartLoc:(/Verse.org/SpatialMath:)transform)<suspends>:void=
        if:
            Target:=Agent.GetFortCharacter[].GetTransform().Translation
            NewBall:=mNewBall?
            Sound:=Entity.GetComponent[MSS_Sounds]
        then:
            BallInt:=GetRandomInt(0,2)
            if. BallInt = 0 then NewBall.SetMesh(Owl_asset)
            if. BallInt = 1 then NewBall.SetMesh(Vulture_asset)
            if. BallInt = 2 then NewBall.SetMesh(Rooster_asset)
            Direction:=FromVector3(Target)-StartLoc.Translation
            AdjustedTarget:=(/Verse.org/SpatialMath:)vector3{Left:=Direction.Left, Up:=0.0, Forward:=Direction.Forward}
            NewBall.ApplyLinearImpulse(AdjustedTarget)
            set Sound.Sounds = array{eagle_asset}
            Sound.Play()
            Sleep(5.0)
            NewBall.Dispose()

    InputAwait()<suspends>:void=
        loop:
            Agent:=InputTrig.PressedEvent.Await()
            spawn. SpawnBall(Agent)

    GiveInput(Agent:agent):void=
        InputTrig.Register(Agent)
        spawn. InputAwait()
        

    OnBeginSimulation<override>():void =
        (super:)OnBeginSimulation()
    
    OnSimulate<override>()<suspends>:void =
        Entity.RoundAwait(true)
        if:
            SimEnt:=Entity.GetSimulationEntity[]
            CPlayerComps:=SimEnt.FindDescendantComponents(cplayer_component)
        then:
            for(CPlayerComp : CPlayerComps):
                CPlayerComp.Team.TeamMemberSpawnedEvent.Subscribe(GiveInput)