I have made a script in witch you can move, but it uses the ridgid ody component so i can only move while grounded. I would like to add a flying mechanic to my game so that you can move around freely without gravity. What changes would i have to make to my current movment script ? Here’s my current script:
`
function Update () {
horizontalMovment = Vector2(rigidbody.velocity.x, rigidbody.velocity.z);
if (horizontalMovment.magnitude > maxRunSpeed){
horizontalMovment = horizontalMovment.normalized;
horizontalMovment *= maxRunSpeed;
}
//transform.Rotate(0,cameraObject.GetComponent(PlayerLookScript).currentYRotation, 0, Space.Self);
rigidbody.AddRelativeForce(Input.GetAxis("Horizontal") * runAcceleration, 0, Input.GetAxis("Vertical")* runAcceleration);
transform.rotation = Quaternion.Euler(0, cameraObject.GetComponent(PlayerLookScript).currentYRotation, 0);
}
`