I want to make a beam particle using particle emitters, how do I make it only stop when it hits an object?
Are you moving the ParticleEmitter around and hitting various objects (or are objects crossing the path of the ParticleEmitter), or is this a stationary setup?
Since ParticleEmitters are based on duration and speed of the particles it would be almost impossible with moving Parts.
If it is stationary then just change the Lifetime variable until the particles disappear at the same point as they ‘hit’ the object.
You may be better off with Beams though, since you can change many of the Beams Properties, including the Attachments.
I want to use particle emitters to make a laser attack, and I’m not using beams.
Then you’re going to have to figure out the distance (Magnitude) from the Raycast to the RaycastResult.Position (target) then do some math to figure out how much time it’ll take for the Particle to travel that distance.
The issue with this is that once the Particle is fired, if the target moves out of the way then the Particle won’t go any further (longer) than when it was originally shot.
Just saying, Particles probably aren’t your best choice. You’re probably best off firing a Part and waiting for it to Touch whatever it hits.
You should look into this thead. Yeah, Raycasting seems like a good way for going about it. If you want to stimulate limiting the range of particles, you should experiment with the particle emitter properties, such as Drag, LifeTime, etc.