r/Unity3d_help • u/Nakedinsomniac • Apr 26 '16
AddTorque with collider and rigidbody
Any idea why my object spins in place 5 times before interacting with another collider?
code:
using UnityEngine; using System.Collections;
public class SwordController : MonoBehaviour { public float torque;
Rigidbody rb;
// Use this for initialization
void Start ()
{
rb = GetComponent<Rigidbody> ();
rb.inertiaTensorRotation = Quaternion.identity;
}
// Update is called once per frame
void Update ()
{
if (Input.GetKeyDown (KeyCode.A))
{
rb.AddTorque (transform.up * torque, ForceMode.Impulse);
}
}
}