Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Don't forget to read Tuesday's email newsletter for your chance to win a free copy of Construct 2!


particle system problems


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Gecko   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 March 2000 - 06:37 AM

i''m working on a particle system right now and am having some trouble with the latest part. i''m trying to make the particles always have acceleration towards the cursor position. i''m sure you''ve all seen those little java apps on the net where the particles follow your cursor around and kind of orbit it. i''d appreciate some help
_________________Gecko___ Gecko Design

Sponsor:

#2 Novalis   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 March 2000 - 07:07 AM

Sure thing, It''s easy...

void GetAcceleration(whatever *particle, whatever *mouse, Vector *accel)
{
/* Get the vector from the particle to the mouse. */
VectorSubtract(mouse->origin, particle->origin, accel);

/* Normalize the above vector (ie make it a 1 unit long vector). */
VectorNormalize(accel);

/* Now scale the vector to your rate of acceleration. */
VectorScale(accel, 10.0);
}

Answer your question? I can provide more details if you want... I''m not sure how much help you need

#3 Gecko   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 March 2000 - 07:42 AM

Ah, thanks!
where can i find implementation of those functions?


_________________Gecko___
Gecko Design

#4 Spellbound   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 March 2000 - 09:16 AM

You have to make them yourself.

Or you can use D3DX

#5 Gecko   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 March 2000 - 12:02 PM

yes i know i have to make them myself. my question was HOW do i make them. actually the only one i need help with is VectorNormalize.


_________________Gecko___
Gecko Design

#6 chippydip   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 March 2000 - 12:23 PM

To normalize a vector, all you have to do is divide by its length. For example, if your vector

v = (x, y)

then the length is just

/v/ = sqrt(x^2 + y^2)

thus the normalized vector will be:

(x, y)//v/ = (x//v/, y//v/)

Simple... hope that helps

(There''s some room for optimization in the math... especially in the sqrt() function which could probably just be aproximated with exceptable result.)

#7 chippydip   Members   -  Reputation: 122

Like
Likes
Like

Posted 03 March 2000 - 12:25 PM

Woah! most of those slashes are supposed to be vertical bars ''/'' I wonder why that happend... Oh, well... they are supposed to be the absolute value (ie, the normalized value) of the v vector.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS