4
$\begingroup$

I was watching a thing on this MMoG that some German kids made and noticed they had really nice shooting actions. every time one of them shot, a bright white line would appear. How would I recreate this for my game? I don't want to use thousands of textured planes cause my machine isn't that great and I don't want to blow it up: happened before.

NOTE: I don't really know if that effect is called a tracer, so if someone knows the real name, I'd be happy!

$\endgroup$
  • $\begingroup$ The muzzle flash? or the bullet mesh? Does it move? $\endgroup$ – VRM Apr 15 '15 at 21:50
  • 1
    $\begingroup$ if it is a simple line try render.drawLine(muzzle, bullet, white) $\endgroup$ – Chebhou Apr 15 '15 at 22:08
  • 1
    $\begingroup$ If the bullet fires straight, why couldn't you just have the gun also shot one partly transparent shadeless plane with a muzzle flash texture that lasts a frame or two? $\endgroup$ – X-27 the fluffy unicorn Apr 15 '15 at 22:14
  • $\begingroup$ Just found an awesome way to do it! answer coming soon. $\endgroup$ – X-27 the fluffy unicorn Apr 16 '15 at 1:15
3
$\begingroup$

You can do this by having your gun, in addition to firing your bullet, also fire a no-colision plane. this plane scales from 0 to 100 in 100 frames. the gun also shoots a bullet that travels one frame every logic tick. when the animation of your laser is running at one frame for every logic tick, the end result will be a no-colision plane filling the space between the gun and the bullet before impact. In the demo below, I have the bullet invisible. All you can see is the scaling plane.

enter image description here

To make your plane scale to get it elongating at a rate of one Blender unit per Logic Tick, use this logic setup.

enter image description here

You need to start with a plane, and move the origin to one edge. then move the edge opposite the origin in to make it One blender unit by Two blender units.

enter image description here

Then set the timeline to frame 100, and in object mode press S to start the scale, press X to constrain the scale along the X axis. Press 100 and then press Enter this will set the scale so that the demotions will be 100 blender units by 2 blender units. press I to set a keyframe, and select Scale

enter image description here

this will set a keyframe with the scale on frame 100.

Now do the same thing at frame 0, only this time we need to set the scale along the X axis to 0.

Set the timeline to frame 0, press S to start the scale, press X to constrain the scale along the X axis. Press 0 and then press Enter this will set the scale so that the demotions will be 0 blender units by 2 blender units. press I to set a keyframe, and select Scale

Now we have the scale animated from frame 0 to frame 100.

However, if we move the timeline, we can see that the animation is not quite right.

enter image description here

We can fix this by going into the graph editor and changing the curve type to linear

enter image description here

Now when we test it, we can see that every frame makes the plane scal one blender unit longer.

enter image description here

$\endgroup$
  • $\begingroup$ Awesome possum... how'd you do it in the santa game? $\endgroup$ – Scalia Apr 16 '15 at 3:39
  • $\begingroup$ That was fairly simple,When you fired the gun, it shot a stream of fast moving, invisible bullets while it randomly changed the visibility for a few no-colision planes that were always pointing away from the gun in random directions. $\endgroup$ – X-27 the fluffy unicorn Apr 16 '15 at 17:31
0
$\begingroup$

You could also have a simple logic brick setup:

Always sensor on TRUE pulse(3 dots on top button). You could tweak it to set how much smoke is generated. Then, in another layer, make a plane, you can either: in the materials, find face orientation, set it to halo, and change rotation until you get it right. You can also duplicate the plane and rotate it 90 degrees on the Z axis, to give it a 3D look. Than give it a smoke texture.(Use CG Textures to find one). Back to your bullet: make an edit object actuator, add object, (smoke object) and connect it to your always sensor. And that is it. You can give the smoke a fading animation, a delay with an edit object actuator, set to end object. But that is up yo you!

$\endgroup$

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.