Im dynamically spawning a bunch of entities which I am dynamically resizing.
In order to affect the colliders scale i am making a new Physics collider to represent the new size using:
BlobAssetReference<Unity.Physics.Collider> collider = Unity.Physics.SphereCollider.Create(new SphereGeometry
{
Center = float3.zero,
Radius = radius
});
commandBuffer.SetComponent(entityInQueryIndex, instantiatedEntity, new PhysicsCollider { Value = collider});
However when i do this i no longer have my CollisionEventsJob fire. (They fire properly if i dont set the PhysicsCollider component)
I assume this is because the collision response is not set to raise collision events on the dynamically instantiated PhysicsCollider.
Is there a way to set the collision response dynamically? Or could this be caused by some other data that i need to set on the PhysicsCollider?
Thanks.