How would you approach this?

The following job is doable but requires a lot of effort. I was wondering if Panda3D has some features that could make this all simpler. I am somewhat new to Panda3D but am willing to bet that it has some features that will make this all so easy. So … I thought I would write this up and post it to see if I got any takers … peeps that could shed some light on these P3D features if they exist.

I am tasked with animating a rocket and its plume as the rocket flies out in 3D space. The plume must be attached to the rocket motor exhaust and oriented like the rocket and it must be scaled according to the instantaneous rocket motor thrust (see following figure … large thrust=>long plume, small thrust=>short plume).

Now, in order to achieve my objectives I will have to do the following:

1. Get a quaternion describing the orientation of the missile at time=t and convert it to a direction vector.
2. Get a vector describing the position of the missile at time=t
3. Determine the length of the missile, divide it by two to get the half distance (model is centered), multiply the half-distance by the direction vector to get a plume translation vector that will place it at the rocket motor nozzle. 4) Adjust the plume translation vector according to the current plume scale.
4. Orient the plume according to the missile and draw the plume.

I have modeled the rocket in LW9 and converted it to egg format (see figure below).

I modeled the plume as two orthogonal planes with a transparent texture mapped onto them (see figure below).

Now, in order to achieve my objectives I will have to do the following:

1. Get a quaternion describing the orientation of the missile at time=t and convert it to a direction vector.
2. Get a vector describing the position of the missile at time=t
3. Determine the length of the missile, divide it by two to get the half distance (model is centered), multiply the half-distance by the direction vector to get a translation vector for the plume.
4. Adjust the plume translation vector according to the current plume scale.
5. Orient the plume according to the missile and draw the plume.

This seems like a lot of work but again it is doable. Anyone want to offer some advice on how to make this a little simpler?

Thanks,
Paul

1. getHpr will return a direction vector (heading, pitch, roll)

2. getPos will return a position vector (x, y, z)

3. getS* with *= to x, y, or z will return the specified dimension

4. depending on how the plume scale is stored (a single float?), you can multiply the displacement vector of the plume accordingly

5. If you parent the plume to the missile, all of its translations and rotations will be relative to the missile, leaving only the relative positioning and rotating up to you.

Hope this helps.

Oh wow … in my Rocket class, changing

``````
self.mPlumeModel.reparentTo(render)``````

to :

``````
self.mPlumeModel.reparentTo(self.mRocketModel)``````

took care of 90% of the problem! The orientation is perfect now. I need to work out a relationship for the x scale (y and z are 1) of the plume, the plume model origin, and the translation from the missile exhaust nozzle in order to place the plume correctly.

Once I do that I move onto learning about the particle engine so I can attach an exhaust trail on this puppy and then I’ll scale the rocket motor sound volume according to the thrust (and distance from camera). Aint Panda3D gr8!

Thanks!
Paul