In the scenario I have zombies spawn and advance to a wall in order to destroy it. However I can’t seem to figure out a simple method to get them to attack any point on the wall other than the center (target.transform.position). Here’s my current code concerning looking and moving:
void lookAt(GameObject target)
{
Vector3 rotation = target.transform.position - transform.position;
Vector3 newDir = Vector3.RotateTowards(transform.forward, rotation, damping * Time.deltaTime, 0.0F);
transform.rotation = Quaternion.LookRotation(newDir);
}
void moveTo (GameObject target)
{
transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);
}
Any way to do this without getting too complicated? Optimally I would like the ai to take up all available space on the elongated cube (wall) and when thats full be able to advance to an open spot when an enemy on the wall is shot.
Can simplify it even a little more: EventSystem.current.SetSelectedGameObject(null);
– SergeantBiscuits