FPS Handling of Weapons

I know the topic sounds strange but I did not find a better name :stuck_out_tongue:

My Problem is: My Character will have multiple weapons and I am thinking about how to implement them.

a) Simply add all weapon geometries in one model and then simply disable the nodes somehow.

This would bloat up the file (which I don’t care about, because If you only have one character the size is equal to having all weps seperated).

What would happen to the vert count, though? Would they still be in the GPU memory and possibly even drawn (If I disable them using CullHint.Always?)

The good thing would be I could add a bone to the weapon to have it move along with the character’s walk-bumpiness.

or what I’m trying right now:
b) Have the character and the weapons seperate and only add the weapon under the character Node

The Problem here is: It’s very hard to animate the fingers to stay in place.
If they don’t, It looks like the weapon is floating/hovering.

Also the weapon won’t move when the character uses his arms a bit (you know that weapon movement whilst walking, I guess?). I could animate the weapon on it’s own, but that will look odd and is hard to keep it in sync.

This is the solution I’d want, but I would love to somehow add a bone between the weapon and the finger, so it inherites the loc/rot from the hand.
Is there a way to do this on runtime using code?

Or would you have a complete different approach?
Note: It is first-person and third-person, so I can’t cheat by simply leaving out the character and add hands to the weapon.

I would go with 2, because that way you can actually start with implementeing only 1-2 weapons. And if you add new ones you cannot break the already working ones in fantastic ways :smiley:

1 Like

Yeah I’d also stick with the 2nd approach. First of all, I’d make a pose of the fingers for your weapon (simply load it into your modelling program and animate the fingers). If you want the character to heave weapon bobbing, then I’d programatically apply a sine to the location of the weapon and the hand bones. If you want to you can also animate manually; you’d have to apply a new location to the weapon every keyframe of the animation.

Another thing you could try is adding the weapon to the attachment node of one of the hand bones (with an offset). But I guess that might look odd too.

1 Like

[quote=“Empire_Phoenix, post:2, topic:32066”]
if you add new ones you cannot break the already working ones in fantastic ways
[/quote] That’s true, yep.
But the way I do it atm is really pain in the a…^^

I have a walk-animation with already placed fingers. The actor however moves his arms a bit (that bobbing), so I manually tried to correct all frames so the fingers stay in place.

Do you know a way to fixate the location of the finger bones (so that blender calculates the rotation to catch up with the arms?)
This would be IK and I’d need to bake it before that?

The Sine is a good Idea as I need the rotation for ray-tracing anyway.
hmm, maybe I just need to improve my animating skills so it looks steady :smiley:

1 Like

Can’t you just copy the location and rotation of the arm / finger bones of the first frame and apply it to each other frame? In Blender you can even select the bone in pose mode, go to the bone menu at the right and right click the rotation menu (where you see the rotation of x,y,z (and w) just right click one of those). There you can select clear keyframes which will remove the keyframes of that bone for the rest of the animation.

The thing is she is streching her upper arm, resulting in her hand going forward.
Then her lower arm is moving a bit upwards, so I have to compensate all that.

→ I cannot delete here finger keyframes.

Or do you mean start with the arms? Delete all keyframes between 1 and 24?
That would be an idea!

Yeah just clear the keyframes of the arm bones as I described above (you don’t have to do that manually) and see what you get.

All FPS games I have seen have separate models for weapon for 1st player and 3rd player views - sometimes for performance reasons (1st person ones are lot more detailed/animated), sometimes for compatibility reasons (different bone attachments, handling etc), sometimes for both reasons.
It doesn’t neccesarily mean that adding fingers to weapon itself is a good idea (as you might want to change skins on them independent from each other) - but 1st person fingers and 3rd person fingers should be different things.

Oh okay :confused:
I’d simply place the camera inside of the head^^
I’ll first stick to the detailed 3rd player view and see if I need to change things.

I don’t know what type of game you are creating but you could also consider simply moving the camera farther away from the player in 3rd person mode, so little thing as slightly incorrect fingers won’t be noticable.

I think arma might in fact shared the model, at least it looks like it is doing that.