Jump to content
Sign in to follow this  
haleks

Create a single particle and attach it to an object

Recommended Posts

Hey guys!

 

I could use some insight from particle effect gurus... I'm trying to use the refract texture to give units a "spectral" effect. So far I use a particle emitter based on @aliascartoons's work on his Strigoi, with a few edits :

_source1 = "#particlesource" createVehicle getpos _this;  
_source1 setParticleCircle [0, [0.1, 0.1, 0.1]]; 
_source1 setParticleRandom [0, [0, 0.1, 1], [0.1, 0, 0.1], 0, 0.1, [0, 0, 0, 0.1], 0, 0]; 
_source1 setParticleParams [
		["\A3\data_f\ParticleEffects\Universal\Refract", 1, 0, 1],
		"",//animationName
		"Billboard",//particleType
		1,//timerPeriod for onscript
		5,//lifeTime
		[0, 0, 0.5],//position
		[0, 0, 0.1],//moveVelocity
		3,//rotationVelocity
		10,//weight
		7.9,//volume
		0.1,//rubbing
		[0.75, 0.6, 2],//size
		[[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]],//color, Array of Array of RGBA Numbers
		[0, 0.1, 0.2, 0.3, 0.1, 0.1],//animationSpeed, Array of Number
		0,//randomDirectionPeriod
		0,//randomDirectionIntensity
		"", "", _this,
		0,//angle, Optional Number - Default: 0
		false,// onSurface, Optional Boolean
		-1,//bounceOnSurface, Optional Number
		[[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]]//emissiveColor, Optional Array of Array of RGBA Numbers
];
_source1 setDropInterval 0.05;

 

This gives a cool visual effect, slowly deforming the unit; but the way particles generation is looped produces an annoying "stutter" in the particles animation : the animation of the refract effect is interrupted when a new particle is spawned - or when it's destroyed, I'm not sure.

 

Is it possible to create one single particle (with a moveVelocity at 0), and would it be possible to attach that particle to the unit? Currently only the emitter is attached, so we have to constantly spawn particles if the unit isn't static, I would like to work around that if it's possible at all.

Share this post


Link to post
Share on other sites
1 minute ago, haleks said:

Is it possible to create one single particle (with a moveVelocity at 0), and would it be possible to attach that particle to the unit? Currently only the emitter is attached, so we have to constantly spawn particles if the unit isn't static, I would like to work around that if it's possible at all.

AFAIK this is impossible at all. But you can attachTo #particlesource.

_source1 = "#particlesource" createVehicle getpos player;
_source1 setParticleParams [
		["\A3\data_f\ParticleEffects\Universal\refract", 1, 0, 1],
		"",
		"Billboard",
		1,
		0.08,
		[0, 0, 0],
		[0, 0, 0],
		0,
		10,
		7.9,
		0.1,
		[1],
		[[1,1,1,0],[1,1,1,2],[1,1,1,2],[1,1,1,2],[1,1,1,2],[1,1,1,0]],
		[],
		0,
		0,
		"", "", _this,
		0,
		false,
		-1,
		[]
];
_source1 setDropInterval 0.05;
_source1 attachTo [player,[0,0,0],"spine3"];

Little tweaked.

 

27 minutes ago, haleks said:

This gives a cool visual effect, slowly deforming the unit; but the way particles generation is looped produces an annoying "stutter" in the particles animation : the animation of the refract effect is interrupted when a new particle is spawned - or when it's destroyed, I'm not sure.

It was when spawned.

[[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]],//color, Array of Array of RGBA Numbers

The first alpha is 1, so.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
41 minutes ago, POLPOX said:

It was when spawned.


[[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]],//color, Array of Array of RGBA Numbers

The first alpha is 1, so.

 

Woah, that was an easy fix. Thanks man! ^^

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×