private void UpdateRotateAgent() { var agentBody = rotate.body; var agentPosition = agentBody.transform.localPosition; var agentRotation = agentBody.rotation; var agentVelocity = agentBody.angularVelocity; var targetPosition = target.localPosition; var turnDirection = CalculateTurnDirection(agentBody, targetPosition, agentPosition); rotate.model = RotateAgent.Update(rotate.model, agentRotation, targetPosition, agentVelocity, turnDirection); }
void Start() { rotate.model = RotateAgent.Create(Quaternion.identity, target.localPosition, 5f); forward.model = ForwardAgent.Create(transform.localPosition, target.localPosition, 1f); }