Sign in to follow this  

creating Particle system. problem with the spread

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
[*]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]. [url=""]See this on why[/url].
[*]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.
[*]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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this