Archived

This topic is now archived and is closed to further replies.

R3alTiMe

Particles Problem...

Recommended Posts

Hi I have been reading the particles tutorial and I am not sure whether its a problem or something I cant understand. It occurus on just the begining of the drawing (like first cycle of the first particles group). Lets say my ship is positioned at x=5; y=5; particle[loop].x=0.0f; particle[loop].y=0.0f; particle[loop].z=0.0f; Those lines the tutorial used used to reset the particles position to center of the screen. I changed the 0.0 to the x and y position of the ship. It works but with only one flaw. Theres a "first group" of particles that are being drawn for about 1 second on the center of the screen and while they dissapear new particles begin to appear at the x,y position coordinates i specified. I believe the problem is at the begining of the loop where its written: float x=particle[loop].x; / float y=particle[loop].y; float z=particle[loop].z+zoom; I checked and those values are never reset on initialiasiation and im positive thats the problem. anyone know how can I fix it? I tried various things and I couldnt figure out how. Thanks. Rotem Tal .

Share this post


Link to post
Share on other sites
Where is the camera, and what''s the value of zoom?
(are you sure the particle is within the drawing volume?)

-Sta7ic

Share this post


Link to post
Share on other sites
Whats crosspost?

And im drawing the particles at 2d. so z is not really relevant.

I debugged and all the values I get from the following lines:
float x=particle[loop].x; /
float y=particle[loop].y;
float z=particle[loop].z+zoom;

x,y,z are 0; therefore thers a short ammount of time few particles appear at 0,0,0 and after 1 cycle they are being assigned new values at particle[loop].x=0.0f which i changed to
particle[loop].x=ship.x;

The problem as I see it is that its assigned the ship.x only after particle.life=0 and then it gets new life. I tried many things to try to assign the x and y position that wont be 0.0 and no luck.
anyone got idea? I took examples straigth from the paritcles tutorial. (NeHe).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You have to change the initilization loop to set the x,y coords so they are not 0. That way they wont have to live out there life from 0 until they reset to your values.

Share this post


Link to post
Share on other sites