• Create Account

## Calculate velocity of subparticles from a main projectile and a launch angle

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.

3 replies to this topic

### #1BlurEffect  Members

163
Like
0Likes
Like

Posted 11 January 2014 - 05:40 AM

Hey guys,

I have to create a firework using particle systems in DirectX 9 but the math/physics stuff is killing me. I've been fiddling around with this for hours and couldn't get it to work as I want it to, which is why I'm now asking here.

I have a projectile flying physically correct that will burst into smaller particles after some time. I want the particles to be dispersed in a cone-like shape defined by the direction of the original projectile and an angle alpha, that are both known. I tried to make a little sketch of what I want to achieve but if you need clarification, feel free to ask.

I have to determine the velocity/flying direction for the particles. As I said, I know the original projectile's velocity/direction and the angle of the cone but I don't know how to combine these two to achieve what I want.

### #2Álvaro  Members

20244
Like
1Likes
Like

Posted 11 January 2014 - 06:18 AM

subparticle_velocity.x = cos(alpha) * projectile_velocity.x - sin(alpha) * projectile_velocity.y;
subparticle_velocity.y = sin(alpha) * projectile_velocity.x + cos(alpha) * projectile_velocity.y;

Or, with complex numbers representing velocities and "angle alpha" represented as (cos(alpha) + sin(alpha)*i),
 subparticle_velocity = projectile_velocity * rotation

Edited by Álvaro, 11 January 2014 - 06:20 AM.

### #3BlurEffect  Members

163
Like
0Likes
Like

Posted 11 January 2014 - 06:46 AM

Thank you very much for your anwer, I will test it soon. Given a 3d space (including a z-component of the velocity) would it be possible to calculate the subparticle velocity in a similar fashion?

5832
Like
1Likes
Like

Posted 11 January 2014 - 07:02 AM

Pick a random vector inside a cone that is axis aligned (e.g. tip of cone at (0, 0, 1), centre of base (0, 0, 0)), then scale and rotate it into the correct orientation using either a matrix or quaternion is probably the easiest way to do it in 3d.

EDIT: You can pick lots of vectors from inside the cone and rotate them all with the same matrix is the reason I would do it that way.

EDIT2: It's probably easier to have the tip of the cone at the origin instead, then you can just pick a random ray from the origin within the cone half angle.

Edited by Paradigm Shifter, 11 January 2014 - 07:06 AM.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

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.