Verse Library verse

01 Device

Creates and logs a spatial transform to represent object positioning and orientation.

verse-library/using-futuristic-prefabs-in-fortnite-creative/01-device.verse

# This is a simple Verse script
# It shows how we might check an object's position

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

position_example := class(creative_device):

    OnBegin<override>()<suspends> : void =
        # Create a transform at the center of the map
        # vector3 holds X, Y, and Z coordinates
        # The number 0.0 means the middle on that axis
        ShipTransform : transform = transform:
            Translation := vector3{X := 0.0, Y := 0.0, Z := 0.0}
            Rotation := rotation{}
            Scale := vector3{X := 1.0, Y := 1.0, Z := 1.0}

        # Print the X position so we can see it in the log
        # note: prefabs are placed in the UEFN editor, not spawned at runtime;
        # this shows how Verse represents a position with a transform value
        Print("Ship X position: {ShipTransform.Translation.X}")

Comments

    Sign in to vote, comment, or suggest an edit. Sign in