- Home /
Help with Ragdoll Character Controller
Alright, I'm trying to create a walking style like this - https://twitter.com/punchesbears/status/715582621946777601
And at the moment I've got a ragdoll setup, with no controls, only to be controlled with the jetpack on his back - you can try it here bufferstudios.com
Anyway, sorry if I'm being a little dull for detail, but thanks in advance if you can help!
Answer by Bren0831 · Dec 16, 2016 at 01:46 PM
I would recommend starting with unity's move script. Then, going with blended animations. /// This script moves the character controller forward /// and sideways based on the arrow keys. /// It also jumps when pressing space. /// Make sure to attach a character controller to the same game object. /// It is recommended that you make only one call to Move or SimpleMove per frame. var speed : float = 6.0; var jumpSpeed : float = 8.0; var gravity : float = 20.0; private var moveDirection : Vector3 = Vector3.zero; function Update() { var controller : CharacterController = GetComponent.<CharacterController>(); if (controller.isGrounded) { // We are grounded, so recalculate // move direction directly from axes moveDirection = Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); moveDirection = transform.TransformDirection(moveDirection); moveDirection *= speed; if (Input.GetButton ("Jump")) { moveDirection.y = jumpSpeed; } } // Apply gravity moveDirection.y -= gravity * Time.deltaTime; // Move the controller controller.Move(moveDirection * Time.deltaTime); }