In my game, the player has an RPG (rocket launcher). Using this launcher, he can shoot a rocket.

When shown in the inventory, the rocket is stuck in the launcher. Also, when the user walks, the rocket is stuck in the launcher, and the RPG (the combination of launcher and rocket) is placed on his back.

Now when the user shoots, the rocket leaves the launcher, and the launcher pulls the player into a little spin to simulate a recoil.

Since the rocket and the launcher are stuck together most of the time, I was thinking that I should have a main game object named "RPG" with the 2 meshes "launcher" and "rocket". Most of the time, they would be stuck together.

When the user launches the rocket, I would change the position of the rocket in order to simulate it flying away. When it has exploded, I would make the rocket mesh invisible.

I was really proud of that plan until I noticed that the recoil will move the rotation and position of the RPG (launcher). Imagine the recoil of a pistol: The recoil will cause the pistol (and the hands) go up a bit.

Now when I do this with the launcher, the rocket will change its flight path. That would look unrealistic.

Can somebody tell me how this is commonly dealt with?

Thank you!


I would not treat the rocket as a part of the rocket launcher. Instead, the rocket is a new entity that is spawned when fired.

Managing the Rocket Launcher

When the rocket launcher is loaded, it can be just a graphical change. In other words, you have two models of the rocket launcher - one with a rocket loaded, one without. This works with 3d models, sprites, or basically any other way your game renders the scene.

When the player loads a rocket, switch to the loaded model. When the player fires, switch to the unloaded model then rotate it.

Importantly, until the point where they actually fire the rocket, there is no rocket object yet in the game. It only exists as a number in their inventory: e.g., "int rocket_count = 5";

If you do have an inventory count, you'll of course not let them load a rocket if the count is zero.

Managing the Rocket

Now as to the rocket, you should make it a completely new and separate object with its own model.

When the player fires, spawn a new rocket object , and it can then become completely independent of the rocket launcher and player, and manage itself however it wishes.

Also of course when they fire, you will subtract 1 from the rocket inventory.


Besides taking care of your animation challenge, it also allows you to have a few other things happen, such as...

  • Player can launch more than one rocket at once if a new one is reloaded before a previously fired one has hit something
  • If the player switches to a new weapon while a rocket is in flight, it won't immediately also remove the rocket in flight
  • Similar to above case, player death will not remove the rocket from the game.
|improve this answer|||||
  • 1
    \$\begingroup\$ Thank you very much! You've also tackled points that I didn't have in mind yet (which you mentioned in "Advantages"). Thank you! \$\endgroup\$ – tmighty Jun 6 '19 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.