- Home /
Question by
Sinperhezine · Jan 05, 2014 at 03:33 AM ·
movecharacter controller
CharacterController.move Glider movement
i'm working on a game where the character can move around using a glider i'm able to get the player to float to the ground just fine but i'm having trouble making it so the player some control over the direction he or she is moving
IE: the character and floating forward but want to move to left. hitting the left key will result the character slowly gliding a bit to the left.
void MoveCharacter()
{
AgentManager AM = this.gameObject.GetComponent<AgentManager>();
CharacterController controller = GetComponent<CharacterController>();
if (controller.isGrounded)
{
if (AM.inCover == false)
{
moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
}
else
{
moveDirection = new Vector3(Input.GetAxis("Horizontal") * -1, 0, 0);
}
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
}
else
{
//everything in this block is suppose to deal with the player in the air when the glider is out
Abilities AB1 = AM.ability1.GetComponent<Abilities>();
if (AB1.glider == true)
{
moveDirection.x = Input.GetAxis("Horizontal");
moveDirection.z = Input.GetAxis("Vertical");
moveDirection = transform.TransformDirection(moveDirection);
moveDirection.x *= speed / moveReduction;
moveDirection.z *= speed / moveReduction;
//moveDirection.y *= speed;
}
}/**/
moveDirection.y -= gravity * Time.deltaTime;
controller.Move(moveDirection * Time.deltaTime);
}
Comment
Please provide more information, as it stands your question is not answerable
Yea we need to see your code. Look at the Unity answers tutorial video if you don't know how to post code on here.
Your answer
![](https://koobas.hobune.stream/wayback/20220613125600im_/https://answers.unity.com/themes/thub/images/avi.jpg)