Question by
onic2999 · Mar 20, 2018 at 02:10 PM ·
scripting problemcharactercontrollerscripting beginnerscriptingbasicsscriptingproblem
Unity CharacterController.Move Issue
So i have been looking at unity's documentation regarding the CharacterController.Move and something is bothering me why this:
void Update () {
if (chco.isGrounded) {
basemo = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
basemo = transform.TransformDirection (basemo);
basemo *= 10;
if (Input.GetButton ("Jump")) {
basemo.y = 10;
}
}
basemo.y -= 20 * Time.deltaTime;
chco.Move (basemo * Time.deltaTime);
}
would let me jump but this
void Update () {
basemo = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
basemo = transform.TransformDirection (basemo);
basemo *= 10;
if (chco.isGrounded) {
if (Input.GetButton ("Jump")) {
basemo.y = 10;
}
}
//basemo = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
//basemo = transform.TransformDirection (basemo);
//basemo *= 10;
basemo.y -= 20 * Time.deltaTime;
chco.Move (basemo * Time.deltaTime);
}
wouldn't even bother lifting a finger.I just want to make it move while in the air,but i can't quite figure it out.Any solution?
Comment