Hand and gun rotation problem, Third Person Shooter
Hello, I'm facing a problem with Unity. I'm working on a TPS game. My problem is that I want to make my character's hand always keep the same rotation (perpendicular to the ground), but the problem is when I play animations sometimes my character's hand rotate and the gun's rotation (gun is attached to hand bone) is not perpendicular anymore. (Sorry my english is very bad, but you can look at the images, may be you will better understand)
Thanks for your help
I honestly don't know what I need to solve the problem
well i guess the problem is, that the gun is a child of the hand. and as soon as the hand rotates, the gun rotates as well. and i bwlieve you only want that it rotates like a air plane does. => gun up and down(like nose up and down) and rotating on the y axis left and right but not the rolling rotation on the z axis
Answer by dan_wipf · Mar 27, 2019 at 04:30 PM
Vector3 rot = Quaternion.Euler(transform.eulerAngles);
transform.rotation = Quaternion.Euler(rot.x,rot.y,0);
thanks but I tried your solution but it seems that it's doesnt work. $$anonymous$$aybe I don't explained correctly. Basically I just want that my hand bone always keep the same orientation regardless of the forearm rotation. I want that when the forearm rotate, my hand keep an perpendicular orientation compared to the ground. But in the actual case my hand bone rotate with the forearm because the forearm is the parent of the hand bone, and so my hand is leaning to the right or the left following the forearm rotation
ah i see.. that’s over my area.. but have a look for bobe restriction on a axis inside mixamo maybe you get further wirh this