I am working on a project now which is about moving a paperboat forth and back. I have applied force to the object which will let the object move just by clicking on a plane. I want the object to spin according to the force too. The object is not rotating at all. Please help me in fixing this problem. My code is...
var strength : float = 10.0f;
var amount: float = 0.0f;
var smooth = 2.0;
var tiltAngle = 30.0;
function Update ()
{
if(Input.GetKeyDown(KeyCode.Mouse0))
{
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast(ray, hit))
{
var delta = transform.position - hit.point ;
rigidbody.AddForce(delta.normalized * strength, ForceMode.Impulse);
rigidbody.AddTorque (0, 10, 0);
}
}
}
Please respond to this question as soon as possible. Thank you...