I feel as if this shouldn’t be happening. But when I set the velocity of my rigidbody using a Vector3 like the following code is showing, it somehow messes up the gravity and the cube object starts floating down really slowly.
rb.velocity = Vector3(xmove, rb.velocity.y, zmove);
Surely this shouldn’t change the vertical velocity of the Ridgidbody at all, but it still does.
#pragma strict
var speed: float;
private var xvel: float;
private var zvel: float;
private var rb: Rigidbody;
function Start () {
rb = GetComponent.<Rigidbody>();
}
function FixedUpdate () {
xvel = Input.GetAxis("Horizontal");
zvel = Input.GetAxis("Vertical");
rb.velocity = Vector3(xvel * speed, rb.velocity.y, zvel * speed);
}
That’s the full code attached to the player.
The reason I’m not using forces is because I want the player to be more responsive in its movement.