How do I make a missile that lands with the nose facing down in BGE? [duplicate]

I'm having a tough time believing this question hasn't been asked before, but I haven't been able to find the answer I'm looking for.

So, I have a mortar style missile launcher in my game that adds an animated explosion ring wherever it hits, and it is oriented in relation to the nose of the missile. The only problem is that it rarely makes contact with a surface the way I want it to. Is there any way to make the nose of the missile always point in the direction it is travelling? I think this will solve the problem.

Pythons scripts are OK, but I'm sure there must be a way to do this from the properties already in Blender. Any answers or suggestions are highly appreciated. Thanks in advance!

• Are you talking about a missile (with constant forward motion - missile, rocket) or a projectile (with initial motion - bullet, arrow, grenade) Dec 14 '16 at 5:46
• A missile with a strong initial motion and low constant forward motion :p It's kind of a cross between a grenade launcher and a missile launcher. Dec 15 '16 at 2:40

Since your question is not 100% clear, I assume the following:

1. You are using rigid body physics on your rocket object
2. You want to point the "nose" of the rocket in the direction in which it is travelling

I did not find a solution with logic bricks to solve point 2, but a few pieces of python code in an old Blender Artist thread (see below 1), which did the job. My minimal example looks like this (*blend below):

It contains an Empty ("spawner"), which spits out the Rocket object (on layer 2) with rigid body physics with a certain velocity in the spawners Y-Axis, triggered by the SPACE Key. The rockets "Nose" is it's Y axis, as seen in the upper part of the screenshot. The python snippet attached to the rocket object now turns the Y axis (second argument of alignAxisToVect) in the direction of motion in every frame. In my example the rocket gets deleted on contact with the Plane object.

Update: The attached *blend uses rigid body physics on the rocket and convex hull collision bounds. This can be simplified to "dynamic" and "box" respectively, so the physics engine has less work to do.

Enjoy!

• Both of your assumptions were correct. This is perfect! I love how simple the script is. Dec 15 '16 at 2:24
• Thank you for taking the time to find a solution. A little update on my progress: Since I first asked the question I added a "track to (the player)" actuator on the explosion animation making the explosion look like a sphere rather than a circle to the player which is really cool looking, and solved some of the visual problem. And now this should fix the rest of it. Thanks :) Dec 15 '16 at 2:32
• Remark: There is no need to convert the linearVelocity to Vector - it is a vector already Dec 15 '16 at 5:11