ParticleEffect (*.pcf not lua) problem

I am working with *.pcf particles and now I have a little problem.

I want that my spawned particle moves from one vector to another, while the target vector is changing constantly.

for Example:

Vector1 == SEnt – Startposition
[Thinkfunktion, Playervector gets updated]
Vector2 == Playerposition – Targetposition.

and if the particle hits the player (That means, if the particle is on the same vector as the player) the particle should remove itself.

Could someone make a little example? (with bbcode)

That’s what I already tried:


	
function ENT:Think()
[...]
        ..My bad..
	self.Bul_Tar_Dis = bullet:GetOrigin():Distance( self.DefinedTar:GetPos() + Vector( 0, 0, 30) ) -- DISTANCE
	self.NewBulletPos = bullet:GetOrigin():Sub(Vector(self.Bul_Tar_Dis, self.Bul_Tar_Dis, self.Bul_Tar_Dis)) -- DIFFERENCE
	bullet:SetOrigin( self.NewBulletPos ) -- MOVEMENT per FRAME
[...]
end


I tried to substract the difference.

[editline]19th October 2011[/editline]

bump

You cannot use pcf particles with util.Effect.

Yes you are right. BUT how can I move pcf particles anyway?

Apply it on another entity and move the entity.

You usually would do that using this entity.

So to move it I can use my code from above?

[editline]20th October 2011[/editline]

Tried now this:



				local bullet = ents.Create( "info_particle_system" )
				bullet:SetPos(self.BonePos)
				ParticleEffectAttach("star", PATTACH_ABSORIGIN_FOLLOW, bullet, 0)
				self.Bul_Tar_Dis = bullet:GetPos():Distance( self.DefinedTar:GetPos() + Vector( 0, 0, 30) )
				self.NewBulletPos = bullet:GetPos():Sub(Vector(self.Bul_Tar_Dis, self.Bul_Tar_Dis, self.Bul_Tar_Dis))
				bullet:SetPos( self.NewBulletPos )


[editline]20th October 2011[/editline]

Hmm didn’t worked. I beat the error is:
self.NewBulletPos = bullet:GetPos():Sub(Vector(self.Bul_Tar_Dis, self.Bul_Tar_Dis, self.Bul_Tar_Dis))
this part, but I dunno.
Or anyone got an better idea?

You should read the valve wiki page more closely.

Yes, but we have 3:22 am and I really need some sleep xD Can’t read long texts atm.
I did it now so:



				local bullet = ents.Create( "info_particle_system" )
				bullet:SetPos(self.BonePos)
				ParticleEffectAttach("star", PATTACH_ABSORIGIN_FOLLOW, bullet, 0)
			if (bullet != nil) then
				local pos = self.DefinedTar:GetPos()
				local ang = (pos - bullet:GetPos())
				ang = ang:Angle()
				bullet:SetAngles(ang)
				setpos = (setpos + (self:GetForward() * (1.5 * 2)))
				local tr = util.QuickTrace(self.DefinedTar:GetPos(), (self:GetPos() - self.DefinedTar:GetPos()), self.DefinedTar)
				if (tr.Hit && tr.Entity != self.DefinedTar) then
					bullet:Remove()
				end
			end




			local pos = tar:GetPos() + Vector(0, 0, 30)
			local ang = (pos - bullet:GetPos())
			ang = ang:Angle()
			bullet:SetAngles( ang )
			repeat
			setpos = (bullet:GetPos() + (bullet:GetForward() * (1.5 * 2)))
			bullet:SetPos(setpos)
			until bullet:GetPos():Distance(tar:GetPos() + Vector( 0, 0, 30)) <= 0


FREEZES MY GAME, please someone: HELP D:

repeat until? Bad idea.

Wow, constructiv reply is constructiv. jk

Any other Idea? (Moving like an rpg_missile, following the player) I need a little example for a brainflash.

[editline]20th October 2011[/editline]

bump

Oh man

Use this

I coded it yesterday myself.