|
| 1 | +--- |
| 2 | +title: "Customizing Camera Controls" |
| 3 | +description: "Intro to custom camera modding." |
| 4 | +authors: |
| 5 | + - name: "Vibe Theory" |
| 6 | + url: "https://discord.com/users/145420279294722048" |
| 7 | +--- |
| 8 | +# Customizing Camera Controls Guide |
| 9 | + |
| 10 | +Hytale provides great camera customizability! Heres the essentials to get started. |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +## The Basics |
| 15 | + |
| 16 | +Camera is controlled by sending a `SetServerCamera` packet with `ServerCameraSettings`: |
| 17 | + |
| 18 | +```java |
| 19 | +ServerCameraSettings settings = new ServerCameraSettings(); |
| 20 | +settings.distance = 10.0f; // Zoom distance from player |
| 21 | +settings.isFirstPerson = false; // Third-person mode |
| 22 | +settings.positionLerpSpeed = 0.2f; // Smooth camera follow |
| 23 | + |
| 24 | +playerRef.getPacketHandler().writeNoCache( |
| 25 | + new SetServerCamera(ClientCameraView.Custom, true, settings) |
| 26 | +); |
| 27 | +``` |
| 28 | + |
| 29 | +This gives you a simple third-person camera. The presets below show more complete configurations. |
| 30 | + |
| 31 | +**Reset to default:** |
| 32 | +```java |
| 33 | +playerRef.getPacketHandler().writeNoCache( |
| 34 | + new SetServerCamera(ClientCameraView.Custom, false, null) |
| 35 | +); |
| 36 | +``` |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## Camera Presets |
| 41 | + |
| 42 | +### Top-Down (RTS/ARPG Style) |
| 43 | +*Source: `com.hypixel.hytale.server.core.command.commands.player.camera.PlayerCameraTopdownCommand`* |
| 44 | + |
| 45 | +```java |
| 46 | +ServerCameraSettings settings = new ServerCameraSettings(); |
| 47 | +settings.positionLerpSpeed = 0.2f; |
| 48 | +settings.rotationLerpSpeed = 0.2f; |
| 49 | +settings.distance = 20.0f; |
| 50 | +settings.displayCursor = true; |
| 51 | +settings.isFirstPerson = false; |
| 52 | +settings.movementForceRotationType = MovementForceRotationType.Custom; |
| 53 | +settings.eyeOffset = true; |
| 54 | +settings.positionDistanceOffsetType = PositionDistanceOffsetType.DistanceOffset; |
| 55 | +settings.rotationType = RotationType.Custom; |
| 56 | +settings.rotation = new Direction(0.0f, -1.5707964f, 0.0f); // Look straight down |
| 57 | +settings.mouseInputType = MouseInputType.LookAtPlane; |
| 58 | +settings.planeNormal = new Vector3f(0.0f, 1.0f, 0.0f); // Ground plane |
| 59 | +``` |
| 60 | + |
| 61 | +### Side-Scroller (2D Platformer Style) |
| 62 | +*Source: `com.hypixel.hytale.server.core.command.commands.player.camera.PlayerCameraSideScrollerCommand`* |
| 63 | + |
| 64 | +```java |
| 65 | +ServerCameraSettings settings = new ServerCameraSettings(); |
| 66 | +settings.positionLerpSpeed = 0.2f; |
| 67 | +settings.rotationLerpSpeed = 0.2f; |
| 68 | +settings.distance = 15.0f; |
| 69 | +settings.displayCursor = true; |
| 70 | +settings.isFirstPerson = false; |
| 71 | +settings.movementForceRotationType = MovementForceRotationType.Custom; |
| 72 | +settings.movementMultiplier = new Vector3f(1.0f, 1.0f, 0.0f); // Lock Z-axis |
| 73 | +settings.eyeOffset = true; |
| 74 | +settings.positionDistanceOffsetType = PositionDistanceOffsetType.DistanceOffset; |
| 75 | +settings.rotationType = RotationType.Custom; |
| 76 | +settings.mouseInputType = MouseInputType.LookAtPlane; |
| 77 | +settings.planeNormal = new Vector3f(0.0f, 0.0f, 1.0f); // Side plane |
| 78 | +``` |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## Imports |
| 83 | + |
| 84 | +```java |
| 85 | +import com.hypixel.hytale.protocol.ClientCameraView; |
| 86 | +import com.hypixel.hytale.protocol.Direction; |
| 87 | +import com.hypixel.hytale.protocol.MouseInputType; |
| 88 | +import com.hypixel.hytale.protocol.MovementForceRotationType; |
| 89 | +import com.hypixel.hytale.protocol.PositionDistanceOffsetType; |
| 90 | +import com.hypixel.hytale.protocol.RotationType; |
| 91 | +import com.hypixel.hytale.protocol.ServerCameraSettings; |
| 92 | +import com.hypixel.hytale.protocol.Vector3f; |
| 93 | +import com.hypixel.hytale.protocol.packets.camera.SetServerCamera; |
| 94 | +``` |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +## Tips |
| 99 | + |
| 100 | +- **Zoom:** Adjust `distance` (higher = further out) |
| 101 | +- **Smoothness:** `positionLerpSpeed` and `rotationLerpSpeed` control how quickly the camera catches up to its target |
| 102 | +- **Wall clipping:** Use `PositionDistanceOffsetType.DistanceOffsetRaycast` |
| 103 | +- **Lock camera:** Set `isLocked = true` in the packet to prevent player changes |
| 104 | +- **2D movement:** Set `movementMultiplier` to zero out an axis |
| 105 | + |
| 106 | +--- |
| 107 | + |
| 108 | +*From Hytale Server build `2026.01.13-dcad8778f`* |
0 commit comments