Third-person village camera that only turns left and right with right-click
Switched the village camera from a quarter view to a perspective third-person view behind the player, with right-click drag turning it left and right only. Zoom and pitch are locked, and other scenes that share the same camera keep their quarter view.
The new village from 132 was still using the old quarter-view camera. I figured the camera should come first, before I touched the layout any more. I framed a shot in the Scene view looking at the plaza from behind the player and decided to make that the default view.
The rules: turn only left and right while holding right-click, and block zooming and tilting up or down. There's no attacking in the village anymore, so right-click was free.
What I built
The default view reads the Scene view values from that moment as is. Perspective FOV 60, 8.06 m behind and 4.93 m above the player's feet (about 9.45 m away), tilted down at a fixed 11.1°. At the start it faces the plaza to the north. I raised the view distance to 1200 so the distant mountains show up.
Dragging left or right with right-click turns the camera, 0.25° per pixel, smoothly catching up over 0.06 s. Moving the mouse up and down or scrolling the wheel does nothing. Rotation is locked while the shop window is open or during the opening sequence, and WASD moves relative to where the camera is facing.
I added a new rotate (orbit) mode to the camera follow. Only the focus point, the player, is followed smoothly, while rotation applies instantly, so the character doesn't drift off center when you turn. I also fixed the opening sequence so it returns to that view when the default camera is perspective. It remembers the projection and FOV at the start, and resets the rotation angle at the start and the end.
Rebuilding the scene would wipe out my layout edits, so I made a separate menu that applies only the camera and leaves the existing layout alone.
I simulated a right-click drag for 30 frames: yaw went from 0° to 60°, while the 11.1° pitch and 9.45 m distance stayed put. Scrolling the wheel didn't change the FOV or distance. Moving forward after a 60° turn goes the way the camera faces. Playing the opening all the way through, the last 10 s glide back to the default view without any jump, and the rotation lock is released.
Things I thought about
- Rotate mode is off by default. SampleScene and the interior scenes use the same camera script. Their quarter view shouldn't change, so it's an option. SampleScene is still an orthographic quarter view and doesn't turn on right-click.
- Using right-click. The player in the new village has no attack component, so right-click is free. I didn't touch the attack code.
Next up
- The opening shot framing is still the quarter-view path just moved out by 1.3×, so reframe it
- NPC name tag size compensation is based on orthographic zoom, so in perspective they always show at the same size
- Turn it with a real mouse and check the rotation sensitivity (0.25)