Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 692 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 3 1 2 3
Re: Particles in Lite-C that actually works. [Re: Jaxas] #248316
01/26/09 01:13
01/26/09 01:13
Joined: Jan 2009
Posts: 34
D
DrunkenPirate Offline OP
Newbie
DrunkenPirate  Offline OP
Newbie
D

Joined: Jan 2009
Posts: 34
Humm, still no go...? I'm stumped!

Re: Particles in Lite-C that actually works. [Re: DrunkenPirate] #248324
01/26/09 02:35
01/26/09 02:35
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Give us a look at your current effect code,
Jaxas's code isnt directional enough for me to test with...


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Particles in Lite-C that actually works. [Re: EvilSOB] #248381
01/26/09 14:50
01/26/09 14:50
Joined: Jan 2009
Posts: 34
D
DrunkenPirate Offline OP
Newbie
DrunkenPirate  Offline OP
Newbie
D

Joined: Jan 2009
Posts: 34
Effect Code:
Code:
		
VECTOR particles_right;
vec_for_vertex(particles_right, ball, 1753);
		
if (key_cuu) {
			    effect(effect_smokes,15,particles_right,normal);
			
}



Function code:
Code:
//// Particle movement handling ///////
function vec_randomize (var* vec, var range)
{
	vec[0] = random(0.5) - 0.25;
	vec[1] = random(0.5) - 0.25;
	vec[2] = random(1) - 0.25;
	vec_normalize(vec,random(range));
}

//// particle alpha handling ////////
function part_alphafade(PARTICLE *p)
{
	p.alpha -= 20*time_step;
	if (p.alpha <= 0) p.lifespan = 0;
}

///// particle creating /////////
function effect_smokes(PARTICLE *p)
{
	p.blue = 46.191;
	p.green = 86.840;
	p.red = 253.129;
	var temp[3]; 
	vec_randomize(temp,3);
	vec_inverse(temp);
	vec_rotate(temp,ball.pan);
	vec_add (p.vel_x, temp);
	p.size = 2.770 ;
	p.gravity = 0 ;
	p.alpha = 50 + random(15);
	p.bmap = particle_map;
	p.flags |= (MOVE | BRIGHT | BEAM | TRANSLUCENT);
	p.event = part_alphafade; // change to a shorter, faster function
}


Re: Particles in Lite-C that actually works. [Re: DrunkenPirate] #248489
01/27/09 06:47
01/27/09 06:47
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Firstly, delete the "vec_rotate(temp,ball.pan);" line out of the function code "effect_smokes(PARTICLE *p)".

than change your effect code to
Code:
...
   VECTOR particles_right, particles_dir;  
   //only one particles_dir needed per ship, same for all engines
   //
   vec_for_vertex(particles_right, ball, 1753);  // get origin point per engine
   vec_set(particles_dir, vector(-10,0,0));      // length of spray
   // tweak the -10,0,0 to get the look you want, maybe size to thrust % if there is one
   vec_rotate(particles_dir, ball.pan);          // rotate to match ship rotation
   ...
and it should do the job


Last edited by EvilSOB; 01/27/09 06:48.

"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Particles in Lite-C that actually works. [Re: EvilSOB] #248710
01/28/09 18:56
01/28/09 18:56
Joined: Jan 2009
Posts: 34
D
DrunkenPirate Offline OP
Newbie
DrunkenPirate  Offline OP
Newbie
D

Joined: Jan 2009
Posts: 34
That example didn't work! Ugh, this is getting crazy! Here is my ENTIRE code:

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

///////////////////////////////////////////////////////////////

VECTOR ball_speed;
VECTOR modelRotate;
VECTOR statbilSys;
ENTITY* ball;
VECTOR temp;
VECTOR pos;
var camera_distance[3]= {-100,0,10};
var camera_angle[3];
var cam_dist[3] = {0,200,300}; // xyz distance vector from camera towards the target 
var engineExhaustAnzahlPartikel = 10; //number of particles used for this effect
function vec_randomize (var* vec, var range);
function part_alphafade(PARTICLE *p);
function effect_smokes(PARTICLE *p);
function increase_roll();
function decrease_roll();
BMAP* particle_map;
particle_map = bmap_create("particle.pcx");
preload_mode = 3;


function main()
{
	video_switch (8,32,2);
	
	level_load("roller.wmb"); // load the level
	wait (2); // wait until the level is loaded
	ball = ent_create ("fighter1.mdl", vector(-400, 0, 100), NULL); // create the ball
	
	modelRotate.x = 90;
	modelRotate.y = 180;
	modelRotate.z = -90;
	c_rotate(ball, modelRotate,USE_AXISR);
	wait(1);	// wait 1 frame after creation
	c_updatehull(ball,0);
	ph_setgravity (vector(0, 0, 0)); // set the gravity
	phent_settype (ball, PH_RIGID, PH_BOX); // set the physics entity type
	phent_setmass (ball, 3, PH_BOX); // and its mass
	phent_setfriction (ball, 80); // set the friction
	phent_setdamping (ball, 40, 40); // set the damping
	phent_setelasticity (ball, 2, 20); // set the elasticity
	
	sky_color.red = 0;
	sky_color.green = 0;
	sky_color.blue = 15;
	
	
	while (1)
	{
		ball_speed.x = 0; // move the ball using the cursor keys
		ball_speed.z = -200 * (key_cuu - key_cud); // 25 sets the x / y movement speeds
		modelRotate.y = 5 * (key_cul - key_cur); // no need to move on the vertical axis
		//VECTOR outVel;
		//phent_getangvelocity (ball, outVel);
		modelRotate.x = 0;
		modelRotate.z = 0;
		ball.z = 300;
		ball.tilt = 0;
		//ball.roll = 90;
		//phent_addvelcentral (ball, ball_speed); // add a torque (an angular force) to the ball
		phent_addforcelocal(ball,ball_speed, vector(0,0,0));
		phent_addtorquelocal ( ball, modelRotate );

		my = ball; // The target Entity
		// calculate the camera view's direction angle to the target
		ANGLE cam_ang[3]; // direction angle of the camera to the target.
		vec_diff(temp,nullvector,cam_dist);
		vec_to_angle(cam_ang,temp);
		cam_ang.roll = 0; // roll didn't change vec_to_angle



		// place the camera at the right position to the target
		vec_set(camera.x,cam_dist);
		vec_rotate(camera.x,my.pan);
		vec_add(camera.x,my.x);
		//vec_add(camera.x,shipVel.z);
		// Set the camera angles to the camera view direction 
		vec_set(camera.pan,cam_ang);
		// and rotate it about the target angle 
		ang_add(camera.pan,my.pan);
		//ang_add(camera.pan, add_pan.pan);
		camera.roll = 360;
		
		
		if (key_cuu) {
			
			VECTOR particles_right, particles_dir;
		vec_for_vertex(particles_right, ball, 1753);
			//only one particles_dir needed per ship, same for all engines
			//
			vec_set(particles_dir, vector(-5,2,2));      // length of spray
			// tweak the -10,0,0 to get the look you want, maybe size to thrust % if there is one
			vec_rotate(particles_dir, ball.pan);          // rotate to match ship rotation
			effect(effect_smokes,15,particles_right,particles_dir);

			//increase_roll();
			
			}else{
			//decrease_roll();
		}
		
		wait (1);
	}
}

//// Particle movement handling ///////
function vec_randomize (var* vec, var range)
{
	vec[0] = random(0.5) - 0.25;
	vec[1] = random(0.5) - 0.25;
	vec[2] = random(1) - 0.25;
	vec_normalize(vec,random(range));
}

//// particle alpha handling ////////
function part_alphafade(PARTICLE *p)
{
	p.alpha -= 20*time_step;
	if (p.alpha <= 0) p.lifespan = 0;
}

///// particle creating /////////
function effect_smokes(PARTICLE *p)
{
	p.blue = 46.191;
	p.green = 86.840;
	p.red = 253.129;
	var temp[3]; 
	vec_randomize(temp,3);
	vec_inverse(temp);
	vec_add (p.vel_x, temp);
	p.size = 2.770 ;
	p.alpha = 50 ;
	p.gravity = 0 ;

	p.alpha = 50 + random(15);
	p.bmap = particle_map;
	p.flags |= (MOVE | BRIGHT | BEAM | TRANSLUCENT);

	p.event = part_alphafade; // change to a shorter, faster function
}

function increase_roll() 
{
	while (ball.roll <= (25+90)) {
		ball.roll += 0.01;
	}
}

function decrease_roll() 
{
	while (ball.roll > 95) {
		ball.roll -= 0.01;
	}
}




Last edited by DrunkenPirate; 01/28/09 18:58.
Re: Particles in Lite-C that actually works. [Re: DrunkenPirate] #248804
01/29/09 08:17
01/29/09 08:17
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Sorry, I didnt realize you model was Z-Axis aligned.
Try it with this line
"vec_set(particles_dir, vector(2,2,5)); //or -5 // length of spray"
instead of your
"vec_set(particles_dir, vector(-5,2,2)); // length of spray"

You can see how Ive just rotated the jets direction around to the z axis.
The particles_dir is the particles intital direction (and sizesince you are using BEAM).
So by setting its Z vector high, jet sprays in that direction.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Particles in Lite-C that actually works. [Re: EvilSOB] #248906
01/29/09 23:03
01/29/09 23:03
Joined: Jan 2009
Posts: 34
D
DrunkenPirate Offline OP
Newbie
DrunkenPirate  Offline OP
Newbie
D

Joined: Jan 2009
Posts: 34
EvilSOB: Sorry, no dice. Even with that changed code it doesn't change anything... Why is this so difficult? It seems simple...

EDIT: vec_set(particles_dir, vector(-1,0,ball.z - (-ball.z*0.99))); // length of spray

Putting that code in allows me to get a bit of the effect I'm looking for, although far from what I need. Maybe this will help?

Last edited by DrunkenPirate; 01/29/09 23:19.
Re: Particles in Lite-C that actually works. [Re: DrunkenPirate] #248908
01/29/09 23:31
01/29/09 23:31
Joined: Apr 2006
Posts: 737
Ottawa, Canada
O
Ottawa Offline
User
Ottawa  Offline
User
O

Joined: Apr 2006
Posts: 737
Ottawa, Canada
Hi

I noticed that you have this line
my = ball; // The target Entity
in a while (1) loop
This means that ball is redefined everytime. Is this a problem?

Ottawa smile

Re: Particles in Lite-C that actually works. [Re: Ottawa] #248923
01/30/09 05:56
01/30/09 05:56
Joined: Jan 2009
Posts: 34
D
DrunkenPirate Offline OP
Newbie
DrunkenPirate  Offline OP
Newbie
D

Joined: Jan 2009
Posts: 34
Ottawa: I changed it, just to make sure everything was okay. It increased speed a bit but nothing more. Thanks!

Re: Particles in Lite-C that actually works. [Re: DrunkenPirate] #248942
01/30/09 08:48
01/30/09 08:48
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Im starting to get confused then, are we still working on the spaceship, or something different?

I'll explain our code-snip a bit and see if it helps. The code you added to mine only makes the spray longer
the further away from height=zero it is (I think).
Code:
   VECTOR particles_right, particles_dir;           //declare vector variables
   vec_for_vertex(particles_right, ball, 1753);     //get engine position
   //
   vec_set(particles_dir, vector(-1,0,30));    //set direction AND distance of particles in relation to UNROTATED entity
   vec_rotate(particles_dir, ball.pan);       //rotate direction and distance to match ROTATED entity (AS IT IS NOW)
   effect(effect_smokes,15,particles_right,particles_dir);  //start spewing particles
Can you try explaining again what you are looking for, AND what it is meant to represent so I can
find the flaw in my understanding of what you want?
Maybe a picture of what shappening now, and a pic of what you want?


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Page 2 of 3 1 2 3

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1