MoveTo

method
MoveTo<override>(

Moves the `advanced_storm_beacon_device` to the specified `Position` and `Rotation` over the specified time, in seconds. Existing storms will not target the new location, but newly generated storms will.

Module
/Fortnite.com/Devices
Declared in
advanced_storm_beacon_device
Source
fortnite

Used in

# This is a "While Loop".
        # In Fortnite terms: This is like a "Respawn Timer" that never ends.
        # It keeps running forever until we stop it.
        loop:
            # Move from A to B
            MoveTo(PointA, PointB)
            # Move from B to A
            MoveTo(PointB, PointA)

    # This function handles the actual movement between two points.
    MoveTo(From: vector, To: vector)<suspends>: void =
        # Check if the target actually exists before trying to move it.
        if (Target):
            # This is the "Magic Line".
            # It tells the prop to slide from 'From' to 'To' over time.
            # It uses "Ease" which means it starts slow, speeds up, then slows down.
            # Like a vehicle accelerating and braking.
            Target.MoveToEase(To, MoveSpeed, ease_type.Linear, animation_mode.OneShot)
            
            # Wait until the movement is finished before moving again.
            # Without this, the target would teleport instantly.
            # This is like waiting for the "Elimination" sound to finish before spawning the next wave.
            Wait(1.0 / MoveSpeed)
Build the Car Primitive verse-library
Current : transform = Body.GetTransform()
        # GetLocalForward gives the prop's own +X axis as a unit vector; scale it
        # by NudgeDistance and add it to the current position. The rotation is
        # unchanged so the car keeps facing the same way.
        Forward : vector3 = Current.Rotation.GetLocalForward()
        Target : vector3 = Current.Translation + Forward * NudgeDistance
        Body.MoveTo(Target, Current.Rotation, NudgeSeconds)
        Print("CarPrimitive: car nudged forward.")
Build the Car Primitive verse-library
NudgeOne(Body : creative_prop)<suspends> : void =
    Current : transform = Body.GetTransform()
    Forward : vector3 = Current.Rotation.GetLocalForward()
    Target : vector3 = Current.Translation + Forward * 250.0
    Body.MoveTo(Target, Current.Rotation, 0.6)
var Hop: int = 0
        loop:
            if (Hop >= HopCount):
                break
            # Compose ONE more 120deg step onto the wheel's CURRENT orientation.
            # Each MoveTo target is only 120deg away -> every hop is an
            # unambiguous shortest-path move (the lesson's gotcha, applied live).
            CurrentRotation: rotation = Wheel.GetTransform().Rotation
            NextRotation: rotation = CurrentRotation.ApplyWorldRotationZ(ThirdTurnRadians)
            Wheel.MoveTo(Position, NextRotation, SecondsPerHop)
            set Hop = Hop + 1
        PrizeGranter.GrantItem(Agent)
distance := GetDistance (player)
                if distance < 500:
                    # If close, move towards the player.
                    # We use MoveTo to tell the NPC where to go.
                    MoveTo (player)
                    # Wait a tiny bit so it doesn't glitch.
                    Wait (0.1)
            
            # Wait a short time before checking again.
            # This saves battery (CPU power).
# MoveTo() for real positional control.
    MoveToTarget(Target : vector3)<suspends> : void =
        loop:
            CurrentTransform := MeshProp.GetTransform()
            CurrentPos := CurrentTransform.Translation
            # Stop when we are close enough (within 5 cm).
            Distance := distance(CurrentPos, Target)
            if (Distance < 5.0):
                break
            # Step 10 % of the remaining distance each tick.
            NewPos := Lerp(CurrentPos, Target, 0.1)
            NewTransform := transform{
                Translation := NewPos,
                Rotation    := CurrentTransform.Rotation,
                Scale       := CurrentTransform.Scale
            }
            MeshProp.MoveTo(NewTransform, 0.01)
            # Wait one tick before the next step.
            Sleep(0.01)
CurrentTransform := MeshProp.GetTransform()
            CurrentPos       := CurrentTransform.Translation
            Distance         := distance(CurrentPos, Target)
            if (Distance < 5.0):
                break
            NewPos := Lerp(CurrentPos, Target, 0.1)
            MeshProp.MoveTo(
                transform{
                    Translation := NewPos,
                    Rotation    := CurrentTransform.Rotation,
                    Scale       := CurrentTransform.Scale
                },
                0.01
# vector3 is a point in 3D space.
        target_spot := vector3{X:=0.0, Y:=0.0, Z:=50.0}

        # We set the duration. 1.0 second is a good start.
        Duration := 1.0

        # Now we tell each crate to move smoothly using MoveTo.
        # sync{} runs all three moves at the same time so they dance together.
        sync:
            # MoveTo takes a target transform, duration, and easing type.
            # We build a transform that keeps the prop's rotation but changes position.
            block:
                crate_1.MoveTo(target_spot, crate_1.GetTransform().Rotation, Duration)
Tag-based working-island loop (button spins tagged props) verse-library
# prop spins one third-turn at a time for several hops (the verified
# keyframed-style MoveTo rotation idiom).

# Custom tags. A tag is any class deriving from `tag`. Put the matching tag
# string on the actors in the editor (set_editor_property('tags', [...])) so
# this device discovers them with NO @editable references.
working_loop_button_tag := class(tag) {}
working_loop_target_tag := class(tag) {}
set NextRot = NextRot.ApplyWorldRotationZ(-0.06)
    if (SteerRight.IsHeld[Agent]):
        set NextRot = NextRot.ApplyWorldRotationZ(0.06)
    var NextPos : vector3 = Current.Translation
    if (Throttle.IsHeld[Agent]):
        set NextPos = Current.Translation + NextRot.GetLocalForward() * 350.0
    Body.MoveTo(NextPos, NextRot, 0.06)