- Home /
CharacterController.move help
Ok so I have a character controller i'm trying to setup and instead of moving along the x axis it seems to be effecting the Y axis, idk how to explain it any more than that
Code:
void Move_Grav(){
if(gravDirection == "Default"){
if(Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow) && player.isGrounded){
moveVector = new Vector3(speed * -1, 0, 0);
}
if(Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow) && player.isGrounded){
moveVector = new Vector3(speed, 0, 0);
}
// if(Input.GetKey (KeyCode.Space) && player.isGrounded){
// moveVector.y = jumpForce;
// }
//moveVector.y -= gravityForce * Time.fixedDeltaTime;
player.SimpleMove (moveVector);
Debug.Log (player.velocity);
}
}
What this code produces is when you try to go the the left or right the character flys to the roof (i have a boxed in enviroment) and glitches up and down near the roof
Comment
Your answer
Follow this Question
Related Questions
Why does my bullet prefab get destroyed? 1 Answer
Opening a door with a key 0 Answers
i want tospawn objects 1 Answer
What is wrong with my script? 1 Answer
Wrong Animation Is Played 0 Answers