Hands-On Challenge Overview
This challenge focuses on experimenting with two camera perspectives across mobile and desktop: Side View and Top View.
You’ll learn how to:
- Transfer ownership of the camera entity
- Changing Camera Modes
- Modifying the Pan settings
Estimated Time: 1 hour
What You'll Need:
- Windows PC
- Access to the Worlds Desktop Editor
- Visual Studio Code
Challenge Steps:
Note: The camera can only be changed for Mobile and Desktop. It cannot be changed in VR. Changing the camera can only be done on a local script.
1. Setup Ownership Transfer
- Create a server script (e.g. CameraOwnershipManagement).
- Add an entity property definition for the camera.
- On player enter world: assign the camera owner to that player.
- On player exit world: assign the camera owner to the world server player.
2. Configuring a Side View Pan Camera
- Create a script called CameraTest
- Set the script execution mode to Local.
- Import the LocalCamera from the horizon/camera API
3. Test Default Settings
- Enter preview mode and observe the camera change. You should see the camera following the player from a side view.
4. Configuring a Top Down Pan Camera
- Modify the camera settings object that is being passed to setCameraModePan to have these setting instead: { positionOffset: new Vec3(0,10,0) }
5. Test Custom Settings
- Enter preview mode and observe the camera change. You should see the camera following the player from a top view.
Level Up:
- Try out the other camera modes available like Attach, Fixed, and First Person.
- Experiment with camera transitions and delay in the camera options.
Need Help?
Related Links