Character Controller - Waist rotation

Im struggling with trying to get this to work. What I would like is a first person character controller in which you can move in one direction and click and hold the right mouse button and be able to pivot at the waist.

As an example; if I’m holding down the forward arrow I’m moving forward, and when I click and hold the right mouse button I can pivot at the waste but yet still move forward. Think of a robot mech. I’d also like the top half of the torso to “snap” back to the forward position when you release the right mouse button.

I was thinking about using a hinge joint with springs. So I used the Character Controller prefab, used three boxes (one for the lower half, upper half and the head), parented the camera to the “head” box, parented that to the “upper torso” box, then parented the “upper torso” box to the “lower torso” box. I assigned the hinge joint to the “upper torso” box. When I move forward the upper torso doesn’t move with the character controller, so it bounces around. If I add a rigid body to the “lower torso” it fall through the ground plane even if I un-check ‘Gravity’.

Maybe this isn’t the best solution. Any thoughts?

Thanks!

Well I sort of got it to work. All I used was the Mouse Look script. The “legs” has the FPSWalker and the MouseLook (MouseX) script. The “torso” has the MouseLook (MouseX) script as well. The “head” is parented to the “torso” which has the camera and the MouseLook (MouseY) script.

When I rotate the torso by clicking and holding down the right mouse button, I would like the script on the “torso” to activate and also deactivate the script on the “legs”. Visa-vera when I release the right mouse button.

Can someone please guide me with scripting that? :slight_smile: