- Home /
Why does my rigidbody.AddTorque gets "limited" ?
I'm working with a RigidyBody attached to a barrel with a sphere collider, and using my movement script which is like this:
using UnityEngine;
using System.Collections;
public class Movement : MonoBehaviour {
private Rigidbody rb;
public float movSpeed, rotSpeed, throttle, turn;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody>();
movSpeed = 25.0f;
rotSpeed = 15.0f;
}
// Update is called once per frame
void Update () {
if (Input.GetKeyUp(KeyCode.UpArrow) || Input.GetKeyUp(KeyCode.DownArrow)) {
//Slower rotation when idle
rotSpeed = 12.0f;
}
//In air shall it slow down rotation speed ???
//Lockrotation
rb.rotation = Quaternion.Euler(0.0f, rb.rotation.eulerAngles.y, rb.rotation.eulerAngles.z);
}
void FixedUpdate()
{
//Moving with keys
throttle = Input.GetAxis("Vertical");
rb.AddTorque(transform.forward * movSpeed * throttle, ForceMode.Acceleration);
//steering
turn = Input.GetAxis("Horizontal") * 1.2f;
rb.AddTorque(Vector3.up * rotSpeed * 1.6f * turn, ForceMode.Force);
}
}
My problem is that, the speed gets limited to a certain amount: 2.5f What is limiting the speed of my transform ?
Thanks in advance !
Answer by Bunny83 · Nov 07, 2015 at 04:11 PM
Just set Rigidbody.maxAngularVelocity to a greater value. Make sure you read the description carefully :)
Oh my gosh. I thought maxAngularVelocity would set the maxAngularDrag. $$anonymous$$istakes of foreign people.. :)
Thanks for help !
:) I'm not a native english speaker either. Even though German is closer to the English language than Hungarian, i also had some problems in the beginning ;) Your question is a perfect fix for UnityAnswers. Good questions are quite rare nowadays.
Legend! Can't believe I didn't know this existed.