Conflict between FollowerEntity and Rigidbody

  • A* version: 5.2.5
  • Unity version: 2022.3.53f1

Hi,

After changing from RichAI to FollowerEntity, I have an issue with entities trying to float up when I set gravity to true in the FollowerEntity:

I’ve realized that it has to do with the presence of a Rigidbody component in the same game object. It stops shaking only if I disable the gravity on FollowerEntity or destroy the Rigidbody (disabling the ‘Use gravity’ property in Rigidbody doesn’t solve the proble either). I’m not familiar with ECS but I’m guessing there is an incompatibility between those two components due to FollowerEntity using ECS? Should I change back to RichAI if I’m not willing to dive into ECS? Would it suffice to disable the gravity on the FollowerEntity, or will it maybe cause other problems in the future?

PS. Also a stupid question: what’s the appropriate way to make the 3D model fit the FollowerEntity base of the shape? I haven’t found a way other than getting the model in a child gameobject and adjusting their transform height:

Hi there, I’m not suuuper sure how movement scripts interact with Rigidbodies but I’ll see what I can dig up. If you turn off their FollowerEntity, what happens then? It kinda looks like since the collider ends up in the ground from Astar pulling it’s center down, gravity pushes it up, which puts Astar above the ground enabling gravity, rinse repeat. So I think the only issue here is the off-center collider/model/etc.

Before I make any suggestions, are these supposed to be halfway through the ground? Or would they normally be on top of the ground?

The follower entity movement is done with Entities, the GameObject just follows the entity. By having a rigidbody on the GameObject, it is causing movement conflicts. There might be a couple ways to get them to work together:

  1. Move the rigidbody and colliders onto the entity. This would force all your collisions to be done with ECS since the two physics systems don’t interact with each other. This would require a deep dive into ECS.
  2. Lock all movement and rotation of the gameobject rigidbody and let the entity control the movement. If you want a physics interaction you would need to temporarily disable follower entity and enable the rigidbody movement.

For your positioning question, you can use parent/child to offset it, or modify the pivot point of the model using blender or other modeling software. I usually prefer editing the model pivot, unless it’s pivot needs to be centered for one use-case and floored for another. Its usually more difficult to get perfect center with parent/child offsets which can cause rotation to be imperfect.

1 Like