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~~
To change the direction of your ParticleEmitter
, you need to change it's acceleration.
The following script sets two ParticleEmitter's
acceleration
towards 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!
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.