Hello,
void Update()
{
var steering = behaviour.GetSteering();
// update position
//transform.position += steering.linearVel * Time.deltaTime;
rigidbody.velocity += steering.linearVel * Time.deltaTime;
if( rigidbody.velocity.magnitude > 7f )
{
rigidbody.velocity.Normalize();
if( rigidbody.velocity.magnitude > 1 )
{
Debug.Log("wtf");
}
}
// rotation
transform.eulerAngles += steering.rotation * Time.deltaTime;
}
As you can see, when the length of velocity goes above 7, I normalize it, which I am pretty sure has to make its length equal to 1. So the “wtf” string should not be printed but it is. Something is wrong here, but I don’t understand what.