3rd Person camera control with Joystick
Hello, I recently searched for a tutorial to implement the movement of a camera3D in third person in C# with the right joystick of a controller, but I didn’t find what I wanted or something easy.
Code
So here’s what I made:
Where the
look
actions are the direction inputs of the right joystick.The
camera
only moves if the length
of the input is higher than the joystickDeadZone
(personally I set it at 0.2f). Then you rotate the player
, the cameraMount
, the meshRoot
using the axis_vector
multiplied by JoystickSensVert/Horz
(personally i set both to 1.5f); and in the end Clamp
the rotation on the Y axis, so the cameraMount, to avoid the effect of going above and below the player.
Root
- Player
- CollisionShape3d
- MeshRoot
- Mesh
- CameraMount
- SpringArm3d
- Camera3d
- SpringArm3d
Result
This is what i got: https://youtu.be/lM55yO5-gVk
Suggest
I also suggest watching the tutorial by Lukky, it’s helped me a lot: https://www.youtube.com/watch?v=EP5AYllgHy8