Noah4ever / SquirrelAttack

3 stars 0 forks source link

Implement move and attack methods #26

Open Noah4ever opened 3 months ago

Noah4ever commented 3 months ago

Implement the Move() and Attack() method.

Reminder of how it works: image Squirrel has method doAction() in which Move() and Attack() gets called

Noah4ever commented 2 weeks ago

Bug with agent slowly start walking again after he got paused. Try saving the agent velocity (https://docs.unity3d.com/ScriptReference/AI.NavMeshAgent-velocity.html) when the simulation gets paused and set the velocity when it resumes. @juliuse98

Example:

void pause() {
  lastAgentVelocity = agent.velocity;
  lastAgentPath = agent.path;
  agent.velocity = Vector3.zero;
  agent.ResetPath();
}

void resume() {
  agent.velocity = lastAgentVelocity;
  gent.SetPath(lastAgentPath);
}