Object picking multiple objects with same variable value

Greetings!

I’ll use the screenshot below to better clarify what I’m asking:

What I would want to know is: how would I create a group of events that would make each red circle go an instant force that’s equal to the sum of every blue square’s Variable value? Each red circle should only be affected by a blue square that has the same ID value.

I’ve been struggling with object picking in one of my projects (let’s call them squares and circles) where I couldn’t figure out how to pick only the squares and circles that have the same variable ID value, so I’m hoping someone here could give me a solution.

Thanks in advance.

I would have to test this but something like this. Dashes represent subevent, indentations.

For each circle
–total = 0 (scene variable) (action)
–square ID = circle ID (condition)
-----for each square, total + square speed
–circle speed = total (action)

Depending on your needs it might be easier to link the objects then you wouldn’t have to mess with IDs.

IDKW direction the circles are going or if it the number of squares are going to change. I would assign the speed or force to a circle object variable and only update it when the squares change. Apply the force from the variable. You might not even need a for each object.

I wanted to test it.

my project (click to open)

These are all of my events. I added a text object to display the values and assigned a random speed.
I used a group named shapes that had both shapes just for setup to add the text object.

This is my result

1 Like

I got it working! I never used the Linking tool so that really helped a bunch with object picking, that was the main problem. Thank you very much!

1 Like