Set Particle angles

Posted By: Benni003

Set Particle angles - 08/07/16 23:56

Hi, is it possible to give a particle pan and tilt angles during a particle effect? I mean currently they are automatic rotated to the camera view, but I want to set individual angles. Is that possible?
Posted By: Superku

Re: Set Particle angles - 08/08/16 07:48

AFAIK it's a pure 2D effect, i.e. no rotation or anything in that regard is involved.
If you want to have angles you will have to use sprites.

If you want to rotate a particle around the "camera-to-particle-axis", for example for smoke sprites or some other effect, you could create a bitmap array which has the particle in let's say 8 or more rotations (made in Photoshop/ ...) and then change the p.bmap pointer dynamically, similar to the sprite+8.tga feature.
Posted By: Benni003

Re: Set Particle angles - 08/08/16 09:17

Okay, thank you Superku.
Posted By: Reconnoiter

Re: Set Particle angles - 08/08/16 09:38

While the result may not be want you want, you can try the 'Beam' or that other flag (forgot the name) for particles. It basically smears the particle in a line towards its destination. So in other words you can use the particle's velocity to give it some depth (think of e.g. lasers or bullet trails). The amount of smearing/stretching depends on the velocity.
Posted By: tagimbul

Re: Set Particle angles - 09/08/16 15:38

it possible
you can write in the particle event my.pan +=1;

Code:
// include lib:
#include <acknex.h>
#include <default.c>
//#include <mtlFX.c>
#include <particles.c>



function p_rot_event(ENTITY* p)
{
	
	var dreahspeed = 0.1;
	my.pan 	+= dreahspeed;
	my.tilt	+= dreahspeed;
	my.roll 	+= dreahspeed;
	
	
}

function particle_event_combo()
{
	p_fade_sprite(me);
	p_rot_event(me);
}

// sprite-emulated particle function
function p_sprite_shine(ENTITY* sprite)
{
	VECTOR vTemp;
	vec_randomize(vTemp,0.4);
	vec_add(sprite._VEL_X,vTemp);
	set(sprite,  BRIGHT | TRANSLUCENT);
	sprite.blue  = random(100); 
	sprite.green = random(1); 
	sprite.red   = random(255); 

	sprite.alpha = 50;
	sprite._SIZE = 2.5;
	sprite._FADE = 2.5;  // fade factor
	
	my.pan	=	random(360);
	my.tilt	=	random(180)-90;
	my.roll	=	random(360);
	
	sprite.event = particle_event_combo;	
}



action act_particle_sog()
{
	while(1)
	{
		effect_sprite("shine.png",p_sprite_shine,maxv(1,20*time_step),my.x,vector(0,0,2));
	 	wait(40);		
	}
}
function main ()
{
	video_window(NULL, NULL, NULL, "Flare Expansion");	
	level_load(NULL);
	ENTITY* particle_sog = ent_create(NULL,vector(0,0,0),act_particle_sog);  
	sky_color.red = 0;
	sky_color.green = 0;
	sky_color.blue = 0; 
	camera.x 	= -344;	

}



change flare2.png with a file on you computer. you need a png with alpha channel
Posted By: 3run

Re: Set Particle angles - 09/09/16 09:12

Originally Posted By: tagimbul
it possible
you can write in the particle event my.pan +=1;
In your example you aren't using particles, but sprites (entities). Maybe you aready knew this, I just wanted to make it clear.

Greets!
Posted By: Reconnoiter

Re: Set Particle angles - 09/09/16 09:50

That reminds me, you could use the shade-c EVO more efficient and better looking sprites, though shade-c has a few downsides but many big improvements, see this link for advantages/disadvantages and help with setting-up -> http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=461868&page=1
© 2024 lite-C Forums