Kinds-of-Intelligence-CFI / animal-ai-unity

Animal-AI Unity
https://github.com/Kinds-of-Intelligence-CFI/animal-ai
Apache License 2.0
2 stars 2 forks source link

Agent-goal collision 'bumping' #7

Closed kozzy97 closed 1 year ago

kozzy97 commented 1 year ago

[Copied from v3 Trello Board]

Agent momentum is disrupted by collision with goals that disappear upon collision - the goal or its collider are not destroyed fast enough, so some physics calculation is done before OnCollisionEnter/OnTriggerEnter are executed.

Only avenue not considered already [per Joel] would be to find a way to add 'exception objects' to RigidBody calculations, whilst preserving OnCollisionEnter condition checks

otherwise would have to overhaul Unit's built-in collision methods and query every fixed frame instead (difficult, convoluted, possibly slower)

kozzy97 commented 1 year ago

I think I found evidence for this bug. If you run a config like the one below, the agent appears to mount the goals a little bit after they disappear. This is not ideal - I wanted to use tasks like this to explore models of foraging behaviour in animals, and this disrupts the trajectories and sometimes leads to the agent 'jumping over' goals and missing them.

!ArenaConfig 
arenas:
  0: !Arena
    pass_mark: 49
    t: 100
    items:
    - !Item
      name: Agent
      positions:
      - !Vector3 {x: -1, y: 0, z: -1}
    - !Item
      name: GoodGoalMulti
      sizes:
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}
      - !Vector3 {x: 0.5, y: 0.5, z: 0.5}