About Store Forum Documentation Contact



Post Reply 
Particle generating direction.
Author Message
menajev Offline
Member

Post: #1
Particle generating direction.
I have particles with one acceleration direction (e.g. y) and I want generating particles opposite to walls, building, etc. But no matter what I put to matrix orn, particles are generating in same direction that given in ME.
Is there any way to make it automatically, or i have to put all accel values manually?
10-21-2009 03:38 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Particle generating direction.
Particles matrix affects only particle position, in order to change their acceleration you need to change the Particles::accel too, but this can be changed only once in the Particles (not for all single particles separately)
10-21-2009 04:55 PM
Find all posts by this user Quote this message in a reply
1991mirec Offline
Member

Post: #3
RE: Particle generating direction.
hi ok let s say have made a particle and it changes the direction each time with something like this:

Code:
particles.accel.x = Players[0].cskel.getPoint(8"fireball").dir.satLength().x*6;
  particles.accel.y = -1;
particles.accel.z = Players[0].cskel.getPoint(8"fireball").dir.satLength().z*6;
i want it just to creat the direction as the slot is but with this it also change the length because different accel makes it go further away.. how can i make it so the length stay the same.. and it will create it as the the point is??

thx in advance..
03-26-2014 06:53 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #4
RE: Particle generating direction.
Assign the values to a Vec, then do Vec.normalize(). Normalizing makes x+y+z = 1. If you want to change the speed after that, you just multiply the vector by the speed value. But be careful, as normalizing uses both square root as well as division, which can be computationally costly if using it multiple times each frame.
03-26-2014 07:27 PM
Find all posts by this user Quote this message in a reply
1991mirec Offline
Member

Post: #5
RE: Particle generating direction.
ok thank you rubeus for fast replay

i don t know if i did something wrong but i did something like this.

Code:
Vec test;
  test = Players[0].cskel.getPoint(8"fireball").dir.satLength();
                                       test.normalize();
                                       particles.accel.x = test.x;
                                       particles.accel.y = -1;
                                       particles.accel.z = test.z;

i dont know if you meant something like this but if yes it didn t do the thing.. even if i didn t put there the satLength() it didn t change anything.. like this it makes a particle but if i move my character to which is slot added it changes the length of particle and right now it even turns it different directions.. i d like to have it so it goes to the side from the character.. slot is not attached to any bone.. it s just moved in front of the character and turned to the side..

any ideas what i am doing wrong??
03-26-2014 08:03 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #6
RE: Particle generating direction.
Vec test = !Players[0].cskel.getPoint(8"fireball").dir;
test.mul( Players[0].matrix( ).orn( ) );

This should give you the normalized direction you want. Check it out this far by printing out the values or using test.draw(...) in the appropriate place(with setMatrix(Matrix( playerPos, MatrixIdentity3))) to see if it's pointing the right direction.
03-26-2014 08:34 PM
Find all posts by this user Quote this message in a reply
1991mirec Offline
Member

Post: #7
RE: Particle generating direction.
thank you for trying .. i know that i am doing something wrong but this is so far what i ve got...
ok don t know how to make it to draw cause that thing didn t work.. but when i applayed it on particle.. sometimes it went further away sometimes it didn t .. and now it doesn t go to the side but either away from me or towards me.. but it should look like some kind of a line but when i turn character in some direction it is a line in some it is longer or shorter and it goes down to dot and then it s again making it more like line.. if it makes sence..
03-26-2014 08:56 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #8
RE: Particle generating direction.
(03-26-2014 07:27 PM)Rubeus Wrote:  then do Vec.normalize(). Normalizing makes x+y+z = 1
Normalizing sets the length to one. Not the sum of all components
03-28-2014 07:45 PM
Find all posts by this user Quote this message in a reply
Rubeus Offline
Member

Post: #9
RE: Particle generating direction.
(03-28-2014 07:45 PM)Esenthel Wrote:  
(03-26-2014 07:27 PM)Rubeus Wrote:  then do Vec.normalize(). Normalizing makes x+y+z = 1
Normalizing sets the length to one. Not the sum of all components

That is correct. And what I wrote was starting to write the formula, then changing my mind but not what I had started writing. Duhr.

Regardless of my brainfart there, using it in that situation should work.
03-28-2014 09:01 PM
Find all posts by this user Quote this message in a reply
Post Reply