forcing per object
-
- Posts: 174
- Joined: 10 Jul 2009, 21:58
forcing per object
I am sure there is a rather simple solution to this however i am stuck. I have a pacman type simulation where I have a bunch of dots on the screen, if a dot is in a volume I scale it to zero, when this happens I would like a global counter to go up by one, I created my counter variable in the modeling stack and it is per object, however when I do my volume check and increase the size of my counter it becomes per point. any help would be appreciated.
Phil Harbath
Jamination Productions
Jamination Productions
Re: forcing per object
maybe Point ID -> Find in Array (with array plugged in array port)?
Re: forcing per object
You cannot increase a per object variable from a per point context: imagine all your points are being processed simultaneously. All the points would try to write on that single per object variable... unpredictable results....
So instead you must use one of the Nodes that collect data. Examples are: "Build Array from Set", "Get Set Sum", "Get Set Avg". These nodes wait untill all your points have been processed (while collecting the data), and then give you the result afterwards.
Short example how to use them is below. That code will recompute each frame, how many dots have been "eaten". Not exactly what you asked for, but I'll let you figure out the rest for yourself ;)
So instead you must use one of the Nodes that collect data. Examples are: "Build Array from Set", "Get Set Sum", "Get Set Avg". These nodes wait untill all your points have been processed (while collecting the data), and then give you the result afterwards.
Short example how to use them is below. That code will recompute each frame, how many dots have been "eaten". Not exactly what you asked for, but I'll let you figure out the rest for yourself ;)
-
- Posts: 174
- Joined: 10 Jul 2009, 21:58
Who is online
Users browsing this forum: No registered users and 28 guests