Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CollidingEntities not being automatically added #572

Closed
spectria-limina opened this issue Dec 2, 2024 · 2 comments
Closed

CollidingEntities not being automatically added #572

spectria-limina opened this issue Dec 2, 2024 · 2 comments
Labels
A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality question Further information is requested

Comments

@spectria-limina
Copy link
Contributor

The CollidingEntities component is not being automatically added to my Colliders.

Not sure why; don't have a minimal repro at the moment. Could be that they don't have RigidBody or other physics components?

@Jondolf Jondolf added question Further information is requested A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality labels Dec 2, 2024
@Jondolf
Copy link
Owner

Jondolf commented Dec 2, 2024

This is expected behavior after #541, to reduce unnecessary memory usage and iteration. In general, it's not desirable to have CollidingEntities for every single collider, since it's not needed by anything internally, and I imagine in most applications you only need to read it for specific entities anyway.

In Bevy 0.15, this would be elegantly solved with required components. For example, if you wanted every character to have CollidingEntities, you could make it a required component for your Character component.

If you still do want every collider to have CollidingEntities, you can use register_required_components to insert it automatically for colliders.

app.register_required_components::<Collider, CollidingEntities>();

@spectria-limina
Copy link
Contributor Author

Ah, this is my fault then. Sorry bout that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Collision Relates to the broad phase, narrow phase, colliders, or other collision functionality question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants