Verse Library verse

01 Use The Orbit Camera In Verse

Adds and removes a fixed-angle camera from all players. Use to change player view in creative experiences.

extracted-snippets/documentation/en-us/fortnite-creative/using-orbit-camera-devices-in-fortnite-creative/01-use-the-orbit-camera-in-verse.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-orbit-camera-devices-in-fortnite-creative
# Local doc:  epic-docs/documentation/en-us/fortnite-creative/using-orbit-camera-devices-in-fortnite-creative.md
# Section:    Use The Orbit Camera In Verse
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# A Verse-authored creative device that can be placed in a level
gameplay_camera_fixed_angle_device_verse_example := class(creative_device):
	# Reference to the Gameplay Camera Fixed Angle Device in the level.
    # In the Details panel for this Verse device,
    # set this property to your Gameplay Camera Fixed Angle Device.
    @editable
    MyFixedAngleCamera:gameplay_camera_fixed_angle_device = gameplay_camera_fixed_angle_device{}
    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=
Print("Adding fixed angle camera to players.")
        # This example iterates through all players in the experience to show how to do operations per player on the device.
        for (Player : GetPlayspace().GetPlayers()):
            # Adds the camera to the `Agent`'s camera stack and pushes it to be the active camera.
            MyFixedAngleCamera.AddTo(Player)
        # Wait 5 seconds
        Sleep(5.0)
        Print("Removing fixed angle camera from players.")
        # Removes the camera from all `Agent`s camera stacks and pops from being the active camera replacing it with the next one in the stack.
        MyFixedAngleCamera.RemoveFromAll()
Copy full snippet

Comments

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