Gun Flare...

I am working on a little project which in the end will be a small FPS. I created a model for the gun and the actions/IPO’s for the firing animation but I cannot figure out how to make a Flare appear momentarily after the gun is shot.
I have created a Flare texture and mapped it to a plane which is tracked to the camera in order to appear as a sprite. I am unable to find any way to make this plane invisible until needed. This may be making it way more complicated than it needs to be and I will accept any asistance although I do not want to use a Blender Flare I do want to use a textured flare so please dont suggest using one.
Thanks in advance…

the best method i am aware of would be to put the flare (parented to the gun object) onto a separate layer, and put an empty(also parented to the gun) at the front of the gun barrel. set the empty to add the flare object when the gun is fired, this method allows you to set the time that the flare object appears for. just remember, parent both the flare and the flare adding empty to the gun, so the flare always appears in front of the gun.

(you can also mess around with scale ipo’s for the flare to make it expand while it is appearing.)

Thanks for the quick reply!:slight_smile:
“set the empty to add the flare”… how would I do this?
I read somewhere else about this but I could not figure out how it is done. I understand parenting just not how to make an object switch layers.

Oh and just in case you were curious…
Here is a quick render of the gun/flare.


You’d be better off using the visibility actuators.
WOW, did you make that gun? It’s pretty realistic. I can help you with a hand for the gun if you’d like.

Not sure what a visibilty actuator is…

I am glad to here you think it looks real, I was trying to get as real as I could get without too many polys.

Unfortunately this is a solo project. I’m trying to prove to a certain “nonbeliever” that Blender(OpenSource in general actually) can be just as good or better than 3DS by creating a game using only Blender and Gimp on my own. So I’m going to have to turn down your offer, thanks anyway though.

Oh by the way your Piano is coming along great!:wink:

Edit: Never mind I researched a visibility actuator. Still don’t understand the other method though…

you would use the edit object actuator in order toget the object to switch layers. type the OB name (can be found in the edit buttons tab [F9]) of the gun flare object into the OB field of the edit object actuator. then use the time slider to set the time that it remains onscreen for.

i would recommend using the edit object actuator over the visibility since it allows easier setup of the gun flare remaining onscreen for a set mount of time as opposed to only when the fire button was pressed. but having not done an FPS before i would defer to someone more experienced than myself on that topic.

I don’t like that edit object actuator because the objects come unparented and “stick” to the air off the gun when moving it.
You could use Python for that too, something live ob.Visible or setVisilbe(X)

they added a set parent actuator recently, as of 2.46 or 2.47. makes it more complex, but i think i have gotten it to work before it was added as well. but the visibility actuator would work fine. just for either method remember to set the flare to no collisions.

Thanks for the info guys.
I think I will use one of the actuators but im not sure which one. I guess I will try both and see which is easier to set up.

Just for curiosity. Enneract, can you explain your previous method of simply parenting it to an empty. I dont think I will use it here but it never hurts to know more info.

I don’t know if it’s what you’re searching,but you could maybe do this :

  • Make a plane with the flare
  • put it just behind the gun (in a way it can’t be seen by the player because the plane isn’t textured on both side)
  • make the plane rotate when you shoot, so it looks like if it has just appeared.
    Have you checked the FPS template?

Its been a while since I have posted to this thread…
Anyway I have another question involving scripting. This time I am attempting to create “bullet holes” and was using the FPS template as a reference. Of course I could just copy the FPS template script but I wanted to see if I could write my own.
The problem is this:
After running the game I get this error ( see image)

And it only happens when the setPosition is enabled otherwise there is no error.
Here is my script,

import GameLogic as g #import the game logic

c = g.getCurrentController()         
o = c.getOwner()                    
add = c.getActuator("addHole")
newobj = add.getLastCreatedObject()

ray = c.getSensor("Bullethole")
click = c.getSensor("leftClick")

ray_coor = ray.getHitPosition()
ray_normal = ray.getHitNormal()

if ray.isPositive() and click.isPositive():
    g.addActiveActuator(add, 1)

Sorry about the lack of comments In my script but I havent had time to add them.


Ok I have done a little experimenting and narrowed my options down a little. It seems that the issue isn’t the setPostition itself but the newobj that it points to. The only thing is I have no idea what is wrong with it and that part of the script is almost identical to the FPS template( which of course works.).