In blender I have a character rig for my FPS with my weapon bones being part of it due to the limitation of blender not letting you create a single action that affects multiple objects. The arm animations work fine but when I try to use a weapon animation the gun moves like it should but is rotated and in the wrong place. The only thing that makes the gun go to the correct position is running the object action which is invisible in blender and still doesn't work properly with where my ammo should be. I keyframed and applied motion to the weapon rig in blender but it didn't fix anything. I want my animations to be like the ones in this tutorial https://docs.godotengine.org/en/3.2/tutorials/3d/fps_tutorial/part_one.html but it doesn't show how they make it work properly from blender to godot. TLDR:I have a rig with my guns on it and when imported into blender the guns are positioned incorrectly.
Weapons in wrong place when imported from blender.
- Edited
ZachAR3 I want my animations to be like the ones in this tutorial https://docs.godotengine.org/en/3.2/tutorials/3d/fps_tutorial/part_one.html but it doesn't show how they make it work properly from blender to godot. TLDR:I have a rig with my guns on it and when imported into blender the guns are positioned incorrectly.
This documentation is somewhat outdated. It may be incompatible with the new version.
I encountered a similar described problem when the animation was rotated in Blender. Solved it by rotating when importing the animation. But without seeing the situation to claim that this is the case, I cant.
However, the author of this tutorial can answer more fully.
I made it by having a single mesh with all the weapons, each rigged to a bone. Then I made animations for each, leaving the weapon I didn’t want to animate alone.
To hide the weapons when not in use, I scaled the root bone containing the weapon to a scale of 0, making it invisible.
At least, I think that is what I did. It’s been a few years since I wrote it and I never really tried to make FPS animations the same way since
You can also use the class BoneAttachment to attach any object to a Skeleton. This is useful for exporting the character without weapons, and then attaching a sword or gun in Godot.
TwistedTwigleg Thats an interesting solution. How do you do it now? I would love to know what a good way is since tutorials for this seem to be pretty much nonexistent
cybereality I tried this originally problem is maintaining scale and positioning for reloading the guns. especially since you can't edit the poses on the fly in godot like you can in Blender. Thanks for the suggestion though
ZachAR3 the last time I looked into it, the way I did it was with empty bones and then using bone attachments to animate it and swap weapons without the need to scale. That was awhile ago and the project I made it for (another FPS) didn’t go anywhere.
I think the bone-attachment method is common for FPS like Destiny, Team-Fortress-Two, or really any first person game that has lots of changeable weapons. For games with a few predefined weapons, the all weapons in one mesh is more common, I think.
Both have pros and cons, so I’m not sure which I’d choose now. I think the bone-based solution is slightly more common overall.
TwistedTwigleg So you animated an empty bone for each weapon and then attached the weapon in godot to get around the nla strip problems? Is it possible to use two rigs in a single nla strip / action or do you have to do it like that?
- Best Answerset by ZachAR3
ZachAR3 So you animated an empty bone for each weapon and then attached the weapon in godot to get around the nla strip problems? Is it possible to use two rigs in a single nla strip / action or do you have to do it like that?
Yeah. I had an empty bone for each weapon (and potentially other bones) and then I animated it using that. Then in Godot I would add BoneAttachments to have the weapons in the correct place. As long as the weapon is the same size and shape as what I was animating for, it worked decently. It was a single rig, the FPS character and all weapon combinations were rigged, but many of the weapons were just empty bones. For animating, I parented the weapons to the armature, did a super simple rig alongside with the FPS character, and then once I was finished I deleted the weapons so it was only the character. Each weapon animation was it’s own action in the rig, and then I just swapped them in code. For transitions, I had each weapon have an equip and un-equip animation that would have the weapon go completely outsize of the camera to hide the weapon suddenly disappearing and a new one appearing, similar to how I did it with the scaling.
However, this was rather time consuming and I didn’t like the results. It also enforced a constraint of all weapons that I wanted to swap out to have the same general shape, otherwise the animations wouldn’t be reusable. I scrapped the project in the end for other reasons (time primarily), but that was the last method I tried for FPS animations. I don’t have the files anymore though, so this is all off memory.
The way I did in the FPS tutorial, rigging the character and all the weapons and then scaling the weapon bones to 0 when not in use, allows for a lot more custom animations and is way easier to animate since you can see the objects how they will look in the end result, but it is not very useful for animation swapping, and the project I was working on prior to scrapping was going to have changeable weapons.
I also looked into IK as a possible solution - but this didn’t work out either. It did send me down the rabbit hole of learning IK though, so that’s something
Ultimately, it is just a tricky issue and I think all the choices are a compromise between easy to animate, easy to use, and easy to swap/customize through code.
TwistedTwigleg Interesting! It seems their aren't any good methods of doing this than haha. Sticking with making the guns part of the rig seems to be the easiest way for good looking animtions I just still have the problem even with remaking my rig of my weapon appearing in the wrong spot even though all the transforms are applied and such, along with their being 2 extra actions (one for the gun and one for the magazine) which for some reason put the gun where it should be. I could just run them are startup but I would like to avoid that if possible.