I Am trying to make an object follow a path with realistic movement. The controller.simplemove just doesn’t seem to be doing anything. For a little bit of extra background info:
Thanks to Maui M it no longer simply drops off into -y, but it still does not move as needed.
The object in question is a “fleet” that contains sub objects “squads”, these squad objects contain ship objects. These ship objects have their own colliders and character controllers (as during combat the need to move independently from the fleet). I saw mention that one person had a similar problem where his object was colliding with it’s own face and so wouldn’t move, however the sub objects are disabled at this time so this can’t be the problem. Thanks for any help in advance.
void MoveTowards(Vector3 position)
{
//movement direction
Vector3 dir = position - myTransform.position;
// Rotate towards the target
myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
Quaternion.LookRotation(dir), rotationSpeed * Time.deltaTime);
Debug.DrawRay(myTransform.position,myTransform.forward);
Vector3 forwardDir = myTransform.forward;
forwardDir = forwardDir * speed;
float speedModifier = Vector3.Dot(dir.normalized, myTransform.forward);
forwardDir *= speedModifier;
if (speedModifier > 0.95f)
{
controller.SimpleMove(forwardDir); <-------------- command in question
//if (!animation["walk"].enabled)
//animation.CrossFade("walk");
}
//else if (!animation["idle"].enabled)
// animation.CrossFade("idle");
}