Moving a prop with both verse and a prop mover working strangely

What I’m attempting to do is move a prop to a random location and then use an attached prop mover to move it straight down. This works as expected for the first instance, but each iteration after the prop will move to a new location correctly, but then move back to its original location instead of moving straight down. I’ve tried many things to get this to work correctly, but nothing has worked. There’s something I’m missing. Any help would be appreciated.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Simulation/Tags }
using { /Verse.org/Random }

# A Verse-authored creative device that can be placed in a level
move_object_drop := class(creative_device):

    @editable var PropBlock : []creative_prop = array{}
    @editable var PropMover : []prop_mover_device = array{}

    BlockDim : float = 384.0 # Block dimensions = 384
    TargDist : float = 26.88 # BlockDim * 7 / 100
    var GridCoords : [][][]int = array{}

    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=
        CreateGridCoords()
        loop:
            for (Index := 0..PropBlock.Length-1):
                spawn { MoveProp(Index,RandomRotation(),RandomPosition()) }
                Sleep(7.0)
                

    MoveProp<private>(Index : int, Rotation : rotation, Position : vector3)<suspends> : void=
        # if (PropMoverSet := PropMover[Index]):
        #     PropMoverSet.Reset()
        if (PropBlockSet := PropBlock[Index]):
            if (PropBlockSet.TeleportTo[Position, Rotation]) { }
            Print("PropBlock moved")
        Sleep(0.1)
        if (PropMoverSet := PropMover[Index]):
            PropMoverSet.Begin()

    CreateGridCoords() : void = 
        GridSize : int = 9 # This should always be an odd number
        if (Offset : int = Floor[(GridSize-1)*0.5]*-1):
            Print("Offset = {Offset}")
            set GridCoords =
                for (Row := 0..GridSize-1):
                    for (Col := 0..GridSize-1):
                        array{Offset+Row,Offset+Col,0}
        if (Xset : int = GridCoords[1][1][0]):
            Print("I think this worked {Xset}")


    RandomPosition() : vector3 = 
        XSet : float = GetRandomInt(-3,3)*BlockDim
        YSet : float = GetRandomInt(-3,3)*BlockDim
        ZSet : float = TargDist*100+(BlockDim/2.0)
        Position : vector3 = vector3 {X:= XSet, Y:= YSet, Z:= ZSet}
        Print("Position: {XSet}, {YSet}, {ZSet}")
        return Position
        

    RandomRotation() : rotation = 
        YawSet : float = GetRandomInt(0,1)*90.0
        PitchSet : float = GetRandomInt(0,1)*90.0 # if (PitchSet < 90.0):
        Rotation : rotation = MakeRotationFromYawPitchRollDegrees(YawSet,PitchSet,0.0)
        Print("Pitch: {PitchSet} Yaw: {YawSet}")
        return Rotation

Did you happen to ever figure this out?
I would have guessed you needed to move the prop mover, or you may have had attached your prop to the mover in UEFN?

Having two different movement methods did never work for me, either by moving by code or with 2 prop movers. You have to work around that. (all by code, or all by movers)

Thanks for the update. I’m really wanting to use the impact detection from the prop mover for my spell system and I’ve been having a hell of a time figuring out how to do it because I need to anchor the devices to a point that follows my character.
My idea for it is going to be to create a custom static mesh with specific component based anchor points that loop teleport to my player, trigger the prop mover via code, move the associated devices with an animation sequence, and sleep the teleportto function for the duration of the spell.
Gonna be an absolute nightmare. :skull:

Well good luck with that, use teleport or moveTo or propmovers or sequencers at the same didn’t work for me, hope you find a way !

Also this could help you :man_shrugging:

I was able to make the prop rotate with verse the way I wanted and still use the prop mover, but I was unable to move the location with verse and still have the prop mover work correctly. Sadly, I gave up and figured out a less than optimal work-a-round. Maybe some day…

The issue is that the Begin() method for prop movers will only move the prop forwards once (as per my testing). You can use another method Advance() to move the prop in the “forwards” direction, which you define in the the editor by the arrow gizmo (I’m assuming you defined the down position to be “forward”).

If you wanted the prop mover to move up after calling Advance() (You moved the prop down), call the Reverse() method, which should bring the prop back to it’s original position. Do note that if you call reverse a second time, it will move your prop up again.

Edit: I think from my understanding, you are simply moving the prop mover to a new position, and then calling the Begin() method. The issue with this is that the prop mover cannot infinitely move a prop forwards from it’s relative starting position. It can only “move forwards” from it’s starting position at most once, so by simply resetting the prop mover’s position world position, the prop mover is still technically in it’s “forward location” relative to itself.

2 Likes

Interesting. That explains why it was always moving back to it’s original X/Y position regardless of where I moved it.

I wasn’t aware of the double Reverse() thing, I think it might solve an issue I have with movers moving away from their origin points!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.