Cancel Prop.MoveTo smoothly

I have a prop that moves in a straight line in a fixed amount of time, I want it to stop midway when I use a trigger device.
However, when I recall a Prop.MoveTo or Prop.TeleportTo at its current position, causing a lag.

Is there any way to stop the Prop smoothly?

You can’t stop it smoothly at the exact frame you tell it to.

If you want something smooth you’ll need to call MoveTo() again right ?

I guess you’d need to pick a target position where the prop will be stopping and then Lerp toward it. If you call MoveTo each frame between current position and target position but with the same duration it will naturally slow down with time :person_shrugging:

Also, to prevent the ‘lag’ you seem to be talking about, just retrieve the correct duration based on the prop speed so that it’s not visible that you called MoveTo again!

Or maybe take a look at AnimationController and easing functions :+1:

  1. You can use small value interpolation.
  2. Write use race between stop event and moveto

You can use PropMover Device or if u realy wanna use verse I just wrote this

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


stop_prop_while_move_test := class(creative_device):

    @editable Prop : creative_prop = creative_prop{}

    @editable TriggerStart : trigger_device = trigger_device{}

    @editable TriggerStop : trigger_device = trigger_device{}

    TravelDistance : float = 2000.0

    var X : int = 2

    var Y : float = 0.0

    var PropPosition : vector3 = vector3{}
    var PropX : float = 0.0
    var PropY : float = 0.0
    var PropZ : float = 0.0
    

    OnBegin<override>()<suspends>:void=

        set PropPosition = Prop.GetTransform().Translation
        set PropX = PropPosition.X
        set PropY = PropPosition.Y
        set PropZ = PropPosition.Z

        spawn {PropMover()}

    PropMover<public>()<suspends>:void=
        race:
            TriggerStartF()
            TriggerStopF()
            MoveProp()

    MoveProp<private>()<suspends>:void=
        loop:
            if(X = 0 and TravelDistance>Y):
                set Y += 10.0
                Prop.MoveTo(vector3{X := PropX, Y := PropY+Y, Z := PropZ}, IdentityRotation(), 0.1)
            else if(TravelDistance<=Y):
                break
            Sleep(0.0)

    TriggerStartF<private>()<suspends>:void=
        loop:
            TriggerStart.TriggeredEvent.Await()
            set X = 0

    TriggerStopF<private>()<suspends>:void=
        loop:
            TriggerStop.TriggeredEvent.Await()
            set X = 1

I am just beginner so maybe it’s not perfect but its working…

2 Likes

@im_a_lama @Dr.Joske @2GHSamburskoy

Thank you all for helping. @im_a_lama’s suggestion using AnimationController did me a favor.

I cannot use PropMover device since PropMover can only be set up at pre-game. What I wanted was objects (about hundreds) spawned at runtime and move.

I apologize for not replying sooner. There has been a lot lately about how we feel about using UEFN.

1 Like

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