There is a scene contains a sphere, this sphere can roll with WSAD keys with the following attached code, I want every frame measure the speed of Sphere Rolling …
private var _GameManager : GameObject;
var movement : Vector3;
var moveSpeed : float = 6.0f;
var drag : float = 2;
function Start()
{
// _GameManager = GameObject.Find("_GameManager");
}
function Update ()
{
var forward : Vector3 = Camera.main.transform.TransformDirection(Vector3.forward);
forward.y = 0;
forward = forward.normalized;
var forwardForce : Vector3 = forward * Input.GetAxis("Vertical") * moveSpeed;
rigidbody.AddForce(forwardForce);
var right : Vector3 = Camera.main.transform.TransformDirection(Vector3.right);
right.y = 0;
right = right.normalized;
var rightForce : Vector3 = right * Input.GetAxis("Horizontal") * moveSpeed;
rigidbody.AddForce(rightForce);
}
Again: what is the right choice ? angularVelocity.magnitude OR velocity.magnitude I hope know the difference