pixel collision
in
Programming Questions
•
2 years ago
Hi , i have an image that have points that was created from an array
with x/ y pixels positions, each point represent a sound, when i touch
each point with the mouse it read that sound.
Im doing this iterating over over all the elements of my array and
comparing it with the x/y position of the mouse.
Is there is a better way in terms of speed and cpu consumtion of
calculating pixel collision with mouse ?
any advice ?
If i use agents instead of the mouse , each agent is gonna iterate over all the array each frame, so if i have 2000 x/y positions in my array it would iterate 4000 times per agent each frame and this is very slow, i just can run a few agents. any idea of how to solve this?
thanks
Seb
with x/ y pixels positions, each point represent a sound, when i touch
each point with the mouse it read that sound.
Im doing this iterating over over all the elements of my array and
comparing it with the x/y position of the mouse.
Is there is a better way in terms of speed and cpu consumtion of
calculating pixel collision with mouse ?
any advice ?
If i use agents instead of the mouse , each agent is gonna iterate over all the array each frame, so if i have 2000 x/y positions in my array it would iterate 4000 times per agent each frame and this is very slow, i just can run a few agents. any idea of how to solve this?
thanks
Seb
1
