This is the code so far I’v got to make it roll and move nicely :
#pragma strict
function Start () {
}
var PlayerJumpSpeed : float = 5.0;
var MaxJumps : float = 30.0;
var PlayerRollSpeed : float = 100.0;
var rotationSpeed : float = 30.0;
var maxRadiansDelta : float = 30.0;
var maxMag : float = 30.0;
var movementSpeed : float = 20.0; /* Block speed */
function FixedUpdate ()
{
var movement = (Input.GetAxis("Horizontal") * -Vector3.left * movementSpeed)+(Input.GetAxis("Vertical") * Vector3.forward * movementSpeed);
rigidbody.AddForce(movement, ForceMode.Force);
// move player by letting them roll the ball
//var rot :float = Input.GetAxis("Horizontal") * Time.deltaTime;
//rigidbody.transform.Rotate(0,rot,0);
Vector3.RotateTowards(Vector3.left,Vector3.left,maxRadiansDelta,maxMag);
var torque = Vector3(Input.GetAxis("Vertical"), 0, -Input.GetAxis("Horizontal"));
//torque = Camera.main.transform.TransformDirection(torque);
//torque.y = 0;
rigidbody.AddTorque(torque.normalized*movementSpeed);
/*if (Input.GetKeyUp("space") && Physics.Raycast(transform.position, Vector3.down, MaxJumps))
{
rigidbody.AddForce(Vector3.up * PlayerJumpSpeed, ForceMode.Impulse);
}*/
}
however it doesn’t turn in an arch like i want it to,reason i want it to turn in an arch coz it would be player friendly,i want them to make a quicker turn to the left or right,I’v tried with the Rotatetowards but to no avail,not sure what to put in the arguments.Thank you.