Glider sim with CharacterController (no rigid body allowed)
I am making a simplified glider simulator for my exam. For this exam we're not allowed to use a rigid body for the player. I have succeeded in using the pitch to gain speed, and lose speed. But I can't seem to work out how to make my character turn using roll and yaw. It is supposed to roll and pitch at the same time make the horizontal movements, this is not supposed to have a big effect in the vertical aspect though. And the horizontal movement/rotation should not be local. In the code right now there is no rolling involved yet.
void Update ()
{
Move();
if (Input.GetButton("Horizontal"))
{
RotateHorizontal();
}
if(Input.GetButton("Vertical"))
{
RotateVertical();
}
}
void Move()
{
Vector3 velocity = transform.forward * currentSpeed * Time.deltaTime;
Debug.Log(velocity);
currentSpeed -= transform.forward.y * gravity * Time.deltaTime;
_characterController.Move(velocity);
}
void RotateVertical()
{
transform.Rotate(Input.GetAxis("Vertical"), 0.0f, 0.0f);
}
void RotateHorizontal()
{
transform.Rotate(0.0f, Input.GetAxis("Horizontal"), 0.0f);
}
Thanks for taking the time to read this. Sincerely
Your answer
Follow this Question
Related Questions
Automatically flip a player game object upright on z axis? 1 Answer
Object rotates normaly while moving, then does zig zags? 0 Answers
Rotating a grid, 0 Answers
ROTATION STOPS when i move the char on the air! 0 Answers
how can I align a rotating block that falls onto another with the correct face? 2 Answers