Jump to content
  • Advertisement
Sign in to follow this  

creating Particle system. problem with the spread

This topic is 2226 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all,

i have been working on a particle system for a while now, but its just not coming together the way i need it too. i am at my wits end with it. the main prblem i have is that my spread doesnt spread at all, it lingers trailing behind the object its attached to.

heres how i start it

p->SetDirection ( Vector2D_Rotate(direction,DegreesToRadians(float(rand() % int(Spreadrate)))));
pos.fX =(float) m_vStartPosX;
pos.fY =(float) m_vStartPosY;

and its update

m_vPosition.fX += Direction.fX * m_vVelocity.fX * dt;
m_vPosition.fY += Direction.fY * m_vVelocity.fY * dt;

any help would be much appreciated

Share this post

Link to post
Share on other sites

  1. When using [font=courier new,courier,monospace]rand()[/font] like that, you should actually do it like: [font=courier new,courier,monospace]static_cast<float>(rand()) / static_cast<float>(RAND_MAX + 1.0f) * Spreadrate[/font]. See this on why.
  2. There isn't anything obvious from this... You're sure that [font=courier new,courier,monospace]DegreesToRadians()[/font] and [font=courier new,courier,monospace]Vector2D_Rotate()[/font] work properly and are returning the correct values? Step through it with a debugger and find out what these functions are receiving as parameters and what they're returning, and make sure they're correct. Make sure your randomness is working correctly.
  3. Are you initializing the random library properly? You have to call [font=courier new,courier,monospace]srand()[/font] once (and only once) in your program before you can start calling [font=courier new,courier,monospace]rand()[/font].

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!