- Home /
Question by
Marshal_Alessi · Jan 07, 2016 at 10:26 PM ·
c#movementjumpaxis
Axis Issue
Hello, I wrote a script for my model for it to move/Jump and whatnot, and am having an issue.
void Update () {
Vector3 forward = Input.GetAxis ("Vertical") * transform.TransformDirection (Vector3.up) * MoveSpeed;
Vector3 jump = Input.GetAxis ("Jump") * transform.TransformDirection (Vector3.forward) * MoveSpeed;
cc.Move (forward * Time.deltaTime);
transform.Rotate (0, 0, Input.GetAxis("Horizontal") * RotationSpeed * Time.deltaTime);
cc.SimpleMove (Physics.gravity);
}
It is important to note that when I imported my model, the axis were wrong...Therefore, the forward vector does use Up, but that works perfectly. Now, the vector after that, Jump, is my problem. I tested it, and if I use Vector3.forward in the line previous to the this variable, it makes the character jump. However, it literally doesn't do anything in the second line.
Comment
Best Answer
Answer by Marshal_Alessi · Jan 07, 2016 at 11:00 PM
I made a simple mistake! For reference purposes, I added in:
cc.Move (jump * Time.deltaTime);
Which fixed the issue!