Hi,
I wrote a script that moves some bots in direction to their target, keep a specified distance to each other and each one follows the bots in front of him.
In my first attempt I attached a rigidbody to the bot. It behaves as expected. Thereafter I removed the rigidbody and used a charactercontroller. After adapting the code I gave it a try and a strange behaviour showed up. Some bots sometime seem to jump. (Have a look at the video please).
public void FixedUpdate()
{
Vector3 kVelocity = steer() * Time.deltaTime;
float fSpeed = ( kVelocity).magnitude;
if ( fSpeed > MaxVelocity)
{
kVelocity = kVelocity.normalized * MaxVelocity;
kVelocity.y = 0.0f;
}
kVelocity.y -= Gravity * Time.deltaTime;
m_kController.Move( kVelocity);
}
}
The steer() function returns a velocity vector with y = 0.
Any ideas what could be wrong?
Thanks in advance!