I am making a game in the game engine which you can get the original .blend file and runtimes here. I am trying to optimize the game as much as possible. One of the ways that I'm trying to do that is by turning the bullets into a single plane instead of a complex object. I want one side of the bullet to always be facing the player's camera so that the bullet doesn't look flat from the top, as it would if the plane was fixed to the bullet. I am trying to use the "Edit Object" track to option but none of my combinations work. When I use the track to option the bullets will always fly in one direction or spin around endlessly in one direction above the player's head. Sometimes the bullet will just disappear. My problem is that when it tracks it tries to make the whole object face my camera and it rotates on all axis. I want the bullet to track using the X-axis but only rotate on the Y-axis.
-
$\begingroup$ Should be able to select the bullet 1st then the player camera (so that the camera is the active object). <ctrl> T to track to. You'll need to rotate the bullet for the correct alignment. If you happen to change the bullet to be a plane you will likely have difficulties with collision detection. $\endgroup$– RattCommented Jan 1, 2018 at 3:28
-
$\begingroup$ Thanks but my problem is that when it tracks to my camera it rotates the whole bullet which makes it spin out of control. I want it to only track on the X-axis and only rotate on the Y-axis. What happens is the object tracks on the X-axis and rotates on all axis instead of just the Y-axis. $\endgroup$– Caden MitchellCommented Jan 1, 2018 at 4:08
1 Answer
Use a simple cube (or rectangle, or whatever shape bullet you want) for the physical bullet. Parent a plane to your bullet's physics object. Set the bullet to invisible, and the plane's physics type to no-collision.
To make the plane track the camera, you can use the method you mentioned of edit object > track to. However, there is an easier way. You can set a material so that it will always face the camera. On your no collision plane, add a material. You can add your bullet texture, but the only setting that matters to make it track the camera is under the material's "game settings." Select the drop down for "face orientation" and select "halo" instead of "normal." What does this do? I'm glad you asked! If, for example, you were using a picture of a tree, you could use "billboard" to make the tree track the camera with rotation only along the Z. However, "halo" tracks the camera on the X, Y, and Z. You may need to go into edit mode in your plane, and rotate it so that the plane is facing it's X axis, for the face orientation setting to work.
Here is the entire process:
-
$\begingroup$ Thank you. I am having a problem with this though. Using billboard and halo mode rotate my bullet model up when I press P. I have it set up for billboard mode where the front of my bullet is facing the local Z-axis. When I start the game it rotates my model so that the bullet is facing up. $\endgroup$ Commented Jan 1, 2018 at 5:29
-
$\begingroup$ Your actual bullet should be nothing more than a cube with whatever physics/logic you use to make it work. It should be invisible, with a no-collision plane parented to it. This plane has no purpose other than to look nice, and should have the material set up to track to the camera. $\endgroup$ Commented Jan 1, 2018 at 6:57