hi,
i have made a particle system in which all the particles are placed to the screen via XML data, i mean all the particles have a predefined position.
What i want to do is to know if the mouse is on one of the particles or not . i want to display different information about these particles, so i need to know which one of te particle index is being collided.
there are some physics.raycast functions, however i don no what to do know.
thank you in advance…
You probably don’t need to do a raycast for this. You can use Camera.WorldToScreenPoint to convert each particle’s world location to its position onscreen. Then, just check to see if it is within acceptable range of the mouse position.
did that
however for 100+ particles my computer started to show slow downs…
is there a faster way?
I tried to change particles into cameraoriented sprites, maybe i can try a mouse to object projection?
i just dont know which fuctions to try out now…
No idea if this would be any faster, but you could try creating a non-rendering sphere/box collider which moves with the mouse pointer, and turn on the particle collider + collision messages for the particles.
Not sure how that’d work with the z axis though.