Need help with bones of reloading the magazine of a gun (Animation)

Hello

I wanted to create a new topic instead of continuing the old one to not make it confusing since my questions there were solved.

I want to achieve a good reload animation where the player takes the magazine out of the gun and puts it back in. I already have a hand animation that reloads and also a gun animation that simulates taking the magazine out of the socket.

I have managed to attach the magazine from the gun to the player hand when the reload animation plays however the rotation of the magazine becomes really broken. I can’t get an optimal rotation for the magazine because when I set the rotation manually in the code for some reason every time I reload the rotation changes every single time. How can I fix the rotation being broken when I parent something?

I also want to be able to achieve the player holding the magazine with the full hand (palm) rather than it being attached to 1 bone. Will it be possible to attach it to multiple finger and thumb bones to get an optimal holding effect?

Below is the same sample project:
https://playcanvas.com/project/876670/overview/anim

I also got 2 more related questions:

  1. Is it possible to attach part of the player arms to a part of the gun? So for example attaching the left hand of the arm to the weapons grip bone. I can attach individual items like gun, mag to the hand but I cannot attach the left hand bone to the grip bone of the gun for some reason. I get the error: Cannot read properties of undefined (reading 'name') I used this.leftHandBone.reparent(this.gripBone);.

  2. Currently some fingers of the hand model goes through the gun/magazine. How can I make it so they don’t clip through? I would really like to attach the hand to the guns grip rather than what it is now because at the moment the hand goes through the magazine of the gun.

Overall I want to achieve/simulate the player holding the gun in an optimal way with a good reload animation where it looks like the hand is holding magazine and nothing clips through each other. Also eliminating any rotation problems.

I would appreciate your guidance :smiley:

Hi @nasjarta, I went through your project and was wondering the reason to use a separate gun animation and separate magazine model and then attach it to the gun? I would simplify it and use animation on the magazine itself as well, like this:

2 Likes

DONE!

Thank you for your help Saad_Haider I am new to working with animations so I did not know how to work it properly. I just added a animation to the gun itself which simulates the magazine going in and out and everything got put into place perfectly :smiley:

So for the arms holding the gun incorrectly and fingers clipping through I must be making a fault with playing the wrong animation in the wrong place maybe? Since the left hand should hold the grip and not clip through the magazine.

Nice work, regarding the fingers clipping, I don’t see that in the above video, and the project is not updated with the above animation, can you update the project so I can take a look at it?

1 Like

Sorry i created a new fork to play with, I updated the original project now.

As you can see in the screenshots the hand should be wrapped around the grip but instead its stuck on the magazine, clipping through it. The hand animation does not achieve this however there is a separate animation called Ref Pose for the gun which could be what I am looking for but I could not get it to work. Maybe there is a problem with the hand or gun scale which may be off I do not know what is the problem.