Hello,
I am currently experimenting with the ECS character controller (1.2.4).
I am developing a zombie survivor type of game.
I have however hit a little snag:
When my hero kills a zombie, I want to play the death animation before I destroy the entity, however I don’t want my hero to target it any longer:
I use a overlap sphere to find enemies in proximity, the cast a ray for the bullet interaction.
For both of these things I use a Collision filter:
BelongsTo: player
CollidesWith: Zombie
I define those on the physics shape assigned to my prefab.
So, the way I was going about this was to add the PhysicsCollider component to my query when in the DeathHandling system,
Then I Set a new CollisionFilter to the collider:
unsafe {
if (physicsCollider.ColliderPtr != null) {
CapsuleCollider* collider = (CapsuleCollider*) physicsCollider.ColliderPtr;
collider->SetCollisionFilter(new CollisionFilter {
BelongsTo = (uint)PhysicsLayers.Dead,
CollidesWith = ~0u,
});
}
}
However this changes to every unit present in my scene, not only the one I called it on.
I am sure it is called only on that single zombie because I was logging the entity index to verify.
I am not sure if this is a bug, or it is the way it is supposed to be.
Being the collider a pointer, could it be that they all point to the same one? if so, why?
Can anybody suggest a solution or an alternative method to achieve my main goal:
still have the character on the scene but prevent any interaction with the player?
Thanks
Kind Regards
Joe