Tuesday, March 19, 2013

Progress. Using a fairly simple script, we managed to shrink the character controller hitbox, which will allow us to shrink him down into a ball to get into hard to reach places. All it took was a simple if/else if statement using the up and down arrows for triggers. We just changed his center of the controller as well as the height. Using Unity's animation abilities, it should look fairly good. Script is as follows: var characterController = GetComponent(CharacterController) as CharacterController; function Update () { if(Input.GetKey("down")){ characterController.height = 2.0; characterController.center = Vector3(0,0.25,0); } else if(Input.GetKey("up")){ characterController.height = 4.0; characterController.center = Vector3(0,1,0); } }

No comments:

Post a Comment