- Home /
How do I make a rigidbody move on command (ie A Player Character)?
This code works but only when the rigidbody's in the air.
#pragma strict
var MovementSpeed : float;
var JumpHeight : float;
private var MovementVer : int;
private var MovementHor : int;
function Update() {
MovementVer = Input.GetAxis("Vertical") * MovementSpeed * Time.deltaTime;
MovementHor = Input.GetAxis("Horizontal") * MovementSpeed * Time.deltaTime;
rigidbody.AddForce(MovementHor, 0, MovementVer);
}
Comment
Is there a friction setting in Unity? It seems pretty strange that it would only work in the air.
Answer by Attapi0 · Jan 11, 2014 at 02:19 AM
The fix is to make sure you're using a capsule, not a box collider!
Oh ok. Yeah, the capsule collider is the standard for humanoid characters.
Your answer
Follow this Question
Related Questions
Make rigidbody walk like character controller 6 Answers
jet pack physics with character controller 1 Answer
Character Controller Jittering 0 Answers
How to prevent friction for character along vertical surfaces? 2 Answers
My character is controlled with Rigidbody, How do I make my character NOT run through objects? 2 Answers