Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a particle emitter go towards a part???

Asked by 7 years ago

So I am making a model where a transparent part is emitting particles towards an NPC's Torso. How would I do this? I'm not requesting; just asking for some ideas.

~~Thanks in advance~~

0
You cant use a particleEmitter for that, you'd have to make your own wich spawns parts that have billboard guis in them, and lerp those parts to the torso's position. I've made a place with this mechanic before, Walk into the fire and jump into the pit, then stand on the altar. https://www.roblox.com/games/156573436/- RubenKan 3615 — 7y
0
@RubenKan You can actually do this with a ParticleEmiiter, take a look at my answer for further explanation. nanaluk01 247 — 7y

2 answers

Log in to vote
2
Answered by
nanaluk01 247 Moderation Voter
7 years ago
Edited 7 years ago

To change the direction of your ParticleEmitter, you need to change it's acceleration.

The following script sets two ParticleEmitter's accelerationtowards the part, constantly.

You have to get the distance from the ParticleEmitter to the torso, and you have to calculate the direction too.

Based on what you have calculated then, you have to calculate what the Acceleration will be.

This is how you would do it:

local Self = script.Parent --The script goes inside the part that the particleemitter(s) are going to follow
local PE = workspace.PE --A part inside workspace which has the ParticleEmitter(s)
local PEFlames = PE.ParticleEmitterFlames --My first ParticleEmitter
local PESmoke = PE.ParticleEmitterSmoke --My second ParticleEmitter


while true do --Infinte loop
    local D = (Self.Position - PE.Position).magnitude --The Distance using magnitude
    local Dir = (Self.Position - PE.Position)/D --The Direction by subtracting the particleemitter's position from the part that is going to be the part that the particles follows, and then dividing it by the distance
    local AccelerationFlames = (Dir*(PEFlames.Speed.Max*1.25)) --The calculation of the acceleration that the first of my particleemiters, get
    local AccelerationSmoke = (Dir*(PESmoke.Speed.Max*1)) --The calculation of theacceleration that the seocnd of my particleemiiters, get
    PEFlames.Acceleration = AccelerationFlames --Sets the acceleration
    PESmoke.Acceleration = AccelerationSmoke --Sets the acceleration
    wait() --Waits a tiny little bit so that the script does not break
end

Here are some link that may help you out as well!

http://wiki.roblox.com/index.php?title=API:Class/ParticleEmitter/Acceleration

http://wiki.roblox.com/index.php?title=API:Class/ParticleEmitter

http://wiki.roblox.com/index.php?title=Magnitude

Here is a link to a gif that shows when this script is in use:

https://www.gyazo.com/60ec8a11318b04724cd362a7076bfefd

If this question answered your question, make sure you click that accept button!

Ad
Log in to vote
0
Answered by 7 years ago

You can set the BasePart that contains the emitter to have a rotation of the inverse of the torso.

pt=Instance.new('ParticleEmitter', workspace.ptbase) -- BasePart
targ=workspace.Part -- Target to inverse
inv=pt.Parent

inv.Rotation=Vector3.new(-targ.Rotation.X, targ.Rotation.Y, targ.Rotation.Z)

--Note that you can also inverse the value of Y or Z according to where the torso is located.

Answer this question