Expand description
micro_bevy_world_utils
packages some common functions used to interrogate the world state from
exclusive bevy systems. One frequent use case for these functions is in implementing a monolithic
physics collisions processor.
§World Interrogation
§World Mutation
send_event
: Send an event
§Entity Sorting
There are several functions that take the form “get_{specifier}_{specifier}_entities”, such as
get_left_right_entities
. These are used to sort two entities according to which specified
components they contain, or to fetch the parent of one or both entities matching the criteria.
{specifier}
takes the following form: [any_](left|right)[[_any]_parent]
any_
implies that no components need to be matched for that side of the query to be successful. This would be equivalent to supplying()
to the version withoutany_
_parent
implies that the returned entity for that side will, if a match is found, be the parent entity of the matching input entity.
N.B. The left component will always be queried first
§Examples
get_left_right_entities
: Match entities to the left and right componentsget_left_any_right_parent
: Match against the left component, and match the parent of the second entity against the right componentget_left_right_any_parent
: Match entities to the left and right components, but return the parent entity of the right entity
Functions§
- clone_
entity_ component - Clone the data from a specific component of the target entity, as long as that entity
has that component and the component itself implements
Clone
- get_
any_ left_ parent_ any_ right_ parent_ entities - get_
left_ any_ right_ entities - Given two entities and a Component type, order those entities based on which one matches the Component type.
- get_
left_ parent_ right_ parent_ entities - get_
left_ right_ entities - Given two entities and two component types, order those entities based on which entity contains which component.
- get_
left_ right_ parent_ entities - Given two entities and three component types, order those entities based on which entity contains the left hand component, and which entity contains the right hand component while having a parent that contains the right hand component. The resulting tuple will contain the left component and the parent component, but not the right component.
- send_
event - Send an event to the appropriate event writer. Writer type is derived from the second parameter passed in, and must be registered with the application before trying to send.