Destroying entity on collision and registry size question. #1033
-
hi, `struct CollisionSystem
};` I have printed the size before and after the collision with ax::log(___), which is axmol engine logger. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
As from the documentation, deleting the entity currently iterated is allowed while deleting other entities is UB. |
Beta Was this translation helpful? Give feedback.
-
yup, I see it now. I solved by creating a small struct called DeadTag. And now, instead of destroying on collision, the system adds that tag. And another method in the gamescene at the end of the update loop checks wich entities has the DeadTag component, and destroys it. One more thing, I have been looking the documentation and searching in the discussions and google to find out how to check if an entity has a specific component and all I saw is a get functions. For instance Thx |
Beta Was this translation helpful? Give feedback.
No worries. You can use
any_of
andall_of
from the registry interface. Otherwise, you can invokecontains
on a view or a storage type. 👍