weapon switching

is there a way to switch weapon (in a FPS) while keeping the weapons on a different layer, i ca get it to work while the weapons are on the same layer as the main character but this slows down frame rate a bit. thanks

slows down the frame rate? what sort of poly count are your weapons!.

You can use the EDIT OBJECT actuator, to change the mesh of the gun with the new one. The one’s not in use can be stored in another layer.

Although I cannot understand your want to put them in a different layer. If you shift select the layer with the weapon as well as having your game layer, then it’s pretty much the same as having them on the same layer.

If what you mean is you want the weapon to be on an overlay scene for some reason then you will have to set up Messege logic bricks to communicate between scenes.

Unless you comp is pretty slow, or the weapons are 1000 poly each, then i can’t see you needing another layer, but if u do want to , use the EDIT object actuator.

-Luke

No the weapons dont have a high poly count but ive got a lot of them, the frame rate drop is severe it’d just be better because later on when ive added more things to my game i might need the extra frame rate… anyway thanks for the help

Well, since there is no function to parent an object to another in realtime (MAN do we need this function badly) the only thing I can think of is if you use python to put the gun every frame to the position of some empty that you parent to the character. It wont be a real parent though, and there is a 1 frame delay which can be very distracting.

if you are not useing armatures, put all the weapons in an invisible layer
and during the game use something like

keyboard “1” >> And >> Edit Obj. Replace mesh “Pistol”

and on and on with 2,3,4,5…

but if you are using armatures… ur screwed…
all ur weapon meshes have to be on the active layer(used scale animations to make them normal size and too small to see)

cuz when u replace a mesh parented to the armature, the mesh no longer follows the bone

how many weapons do u have? and how many mhz is your processor?

blender is really demanding on hardware.

cuz when u replace a mesh parented to the armature, the mesh no longer follows the bone

Not true. Just make sure the new mesh has vertex groups named after the bones you want to effect it.

A replace mesh actuator is propably the best way. Make sure to have a property that keeps track of which gun is active, so that it fire the right amo, etc.