Archived

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

Rocket Trails... oh and I suck at math =P

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

Recommended Posts

Hey all, I've got a particle emitter, but for the sake of argument, lets call it a rocket ship. The rocket ship has a 3d position vector and a 3d direction vector. I'm looking to shoot the particles out from behind the rocket ship, to create a rocket trail behind it. So basically, if the ship is going up, the trail needs to shoot outwards in a downward direction. If the ship is heading right, the trail needs to go left. Heres my guess at how you do it: You normalize the direction vector to get a unit vector, then you somehow inverse it and apply whatever speed you want to the actual trail. How would you calculate such a thing? And be gentle, I suck at math =) [edited by - GroZZleR on February 26, 2004 2:43:59 PM]

Share on other sites
Hmmm, not to familiar with vectors 'n' such in programming. But I know math.

If it is moving up at 10 M/Sec and the particles are shooting out the back at 10 M/Sec I would imagin: The particles will either start with 0 velocity and move down at 10 M/Sec or start out with a vector of 10 M/Sec upward (because they came from the rocket ship they have the same velocity) in which case they would simply cancel each other (-10 and 10) and puff up around the bottum of the rocket because they would have the same speed and direction. There rate of change in relation to the rocket would be 0.

If they start with no inherent vectors/velocity: Just have them shoot in the oposite direction of the rocket and the same speed the rocket is moving (or more or less).

If they start with a inherent vector/velocity from the rocket you will probably need to give them a speed of 0 (a literal "trail") or give them -20 M/Sec velocity so that they would actually start out heading 10 M/Sec downward.

If you asking how to "reverse" a vector I'm not real sure. Not sure what format you specify the direction in. If it's something like X angle, Y angle, Z angle (45, 0, 45 lets say) you would simply subtract 180 degrees from each value, and it will be heading in the oposite direction.

Uhh...

If if you specify the direction with quardinates I think you would just times the values by -1.

Uhh...

If you specify the anges in percent or decimal format you would subtract .5 or 50%.

All the posible formats I can think of. Hope it helps.

[edited by - Cyber-Ace on February 26, 2004 2:53:04 PM]

[edited by - Cyber-Ace on February 26, 2004 2:54:57 PM]

Share on other sites
I think you have it there.

You just need to multiply your direction unit vector by the speed you want the trail to move at, with the positive direction being the direction the ship is currently facing. So if you want the trail to go speed 5, away from the ship it would be speed -5.

Share on other sites
Take forward direction vector.

Normalize this vector. (if it''s not already)

Scale vector by negative of speed you want particles to move
(multiply every scalar value by speed, and negate them)

Viola!

On a rocket ship: The trails should be launched at a constant speed relative to the ship. This speed would most likely be quite a bit higher than the ship''s speed, but in the end of the day, play with it until it looks good. (the real world ain''t allways all that pretty)

Share on other sites
Take the velocity vector and multiply by a constant k. k should be negative and I''m guessing a magnitude smaller than 1 (try -0.5). This would be your base Exhaust vector. Then, for each exhaust particle I would add a small random disturbance to get the smoke to disperse a bit.

Something like:

k_Vel = -0.5; // Velocity scaling
k_Rnd = 0.1; // Random disturbance scaling
E_x = k_Vel * V_x + ((rand () % 2000) * 0.001 - 1.0) * k_Rnd;
E_y = k_Vel * V_y + ((rand () % 2000) * 0.001 - 1.0) * k_Rnd;
E_z = k_Vel * V_z + ((rand () % 2000) * 0.001 - 1.0) * k_Rnd;

lonesock

Piranha are people too.

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 9
• 11
• 9
• 9
• Forum Statistics

• Total Topics
633714
• Total Posts
3013491
×