I have a bit of code, taking my ball thats rolling around and based on left or right makes the ball “roll” that way…
var tilt : Vector3 = Vector3.zero;
var speed : float = 200;
var jumpHeight = 8;
private var isFalling = false;
function Update() {
tilt.x = -Input.GetAxis("Horizontal");
rigidbody.AddForce(tilt * speed * Time.deltaTime);
if(Input.GetKeyDown(KeyCode.W) isFalling==false)
{
rigidbody.velocity.y = jumpHeight;
}
isFalling=true;
}
function OnCollisionStay()
{
isFalling=false;
}
The rolling I calculate the rotation of the ball based on distance and circumference etc, its i graphical hack. I was using the AddRelativeTorque, but the thing was TOO unresponsive.
The problem is, I noticed when I jump, i start moving much faster and when im on the ground I am clamped in speed… or something, my ground just consists of cubes and that which has a box collider on it. I was wondering if there was some friction value somewhere causing it to slow down when moving on ground, and how I could change that (I don’t want ice, but would love same speeds when jumping and on ground).