Version 1.2
Hello everyone!
As I promised, I am sharing with the community the code of my character controller in the third person.
Demonstration video:
features:
- Character Movement in Third Person Shooter style.
- Rotate camera as mouse movement.
- Physics-based controller.
Reminding everyone that this code is free for any use, I ask only just put my name in the credits of your project. Att. Rodrigo Medeiros.
Change Log:
V1.2: Fixed Incompatibility problem with paradox 1.2.2.
V1.1: Added limit to vertical camera rotation.
Follows the code:
ControladorDePersonagem: http://pastebin.com/4nFbabkZ
ControleOrbital: http://pastebin.com/29m00RYS
Scene preparation:
1) First thing you need to do is create a character model, with this animations:
∙ Idle
∙ StrafeLeft
∙ StrafeRight
∙ WalkingBack
∙ WalkingForward
∙ Sprint
2) In the scene, put your character model and add to him a Physical Collider (capsule) and all animations.
3) Next, add an entity model sphere, name it as Orb, set this scale to X1, Y1, Z1 and make it a child of your character entity.
4) Now, create a Camera, and make it a child of the Orb entity.
5) Maintain the camera axis X and Y aligned to the center of orb, and move the Z until the camera is outside of the Orb.
6) Then, go to Orb and Uncheck the model parameter, and now the Orb becomes invisible.
7) Maintain the Z axis of orb aligned to your character and move the orb at the position if you desires to your game camera, and use de Z axis of camera to regulate the distance.
8) Now, add the script ControladorDePersonagem to your character, and ControleOrbital to your orb.
9) Now lets play, and have a fun!