-
Hi all--thanks for the great help so far! This time I have several pointers hovering over entities and need to count how many are over each. Think a usual case of multi-touch. Although right now I'm creating a small cloud of pointers around the cursor-driven standard one so I can do a "sloppy line select", i.e. can hover near the line and still arm it. (Alternatively, maybe there's a non-skinny-ray selection mechanism similar to Rapier's shape-casting?) Anyway, with a single pointer I could insert & delete a marker component. (The first code block below)
I know I can get access to the component fields to do this increment/decrement in a normal system, but would prefer to localize this trivial increment/decrement in the entity callback itself. Made-up pseudocode calls in this second code-block. Is it possible?
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You cannot directly access to components using |
Beta Was this translation helpful? Give feedback.
You cannot directly access to components using
Commands
, but in this case you don't have to necessarily useCommands
.On
has other constructors, in particular there istarget_component_mut
if you only want to mutate a component on the target (like in yourOn::<Pointer<Out>>
example), andrun
if you want to run a full system (which you might want to do in yourOn::<Pointer<Over>>
example, also note that in this case you'll need to manually get the target data using aListener<E>
system parameter).