heron
heron copied to clipboard
PendingConvexCollision should apply to same Entity level
The current implementation of PendingConvexCollision
applies the generated CollisionShape
to the child containing the mesh. This is confusing and likely not what the user intended if the component was .insert()
ed to some parent of the mesh. This is even more confusing when you attempt to use the collision data through Collisions
or CollisionEvent
, as the entity in question is not the one where the PendingConvexCollision
component was added.
I'll add that I ran into a really obtuse issue when attempting to raycast into a PendingConvexCollision because my filter wasn't catching what I expected due to this. If it's intended, it certainly can be confusing, especially since importing meshes from glb, for example, creates some pretty steep hierarchies pretty quickly
Thanks for the feedback. What API and behavior would you prefer instead?
I experience the same confusion. I would expect that all collision-related components would replace PendingConvexCollision
on the same Entity it was set on.
Use case:
- I start prototyping with a simplified collision shape and set
RigidBody::Dynamic
,CollisionShape::Sphere { radius: 1.0 }
,CollisionLayers::default()
,Velocity::default()
etc. on an entityA
, and spawn a sceneB
as that entity's child. - Later I replace
CollisionShape::Sphere { radius: 1.0 }
withPendingConvexCollision::default()
to make a more precise collision shape - I expect a new
CollisionShape
to be generated based on meshes from sceneB
, but added to the entityA
, notB
or any children ofB
. I expect components ofA
to stay exactly the same except forCollisionShape::Sphere { radius: 1.0 }
replaced.
I hope this clarification helps!
bardt's use case is spot on, but I would like to add that the current method of adding indepentent colliders to every child mesh actually does have some useful cases, such as if you spawn a scene and just want all meshes to have independent colliders. I'd suggest keeping the current functionality as some kind of feature