- Home /
Question by
popcornistleckerokay · May 21, 2020 at 02:42 PM ·
rotationraycastmousepositionbone3rd person controller
Player Chest rotates always in the same direction
Hello, i want my character to move his chest in the direction of the ray when he aims with his weapon.
my attempt looks like this:
rotx += Input.GetAxis("Mouse X");
roty -= Input.GetAxis("Mouse Y");
rotxangle = Mathf.Clamp(rotx, -30, 30);
rotyangle = Mathf.Clamp(roty, -30, 30);
chest.rotation = Quaternion.Euler(rotyangle, rotxangle, 0) * chest.rotation;
Now he aims in the direction of the mouse but if your rotate the caracter the direction will stay the same means that he rotates his bone always to the side of the mouse. What am i doing wrong or is there a better approach for this problem then mine?
123.jpg
(66.2 kB)
Comment
Your answer
Follow this Question
Related Questions
How to incorporate a rotation towards mouse position in this script? I tried 0 Answers
Making an object follow the mouse in 3D world 0 Answers
3rd person 3D aiming 1 Answer
RaycastHit2D to hit an enemy when player rotates. (Using keyboard input only) 2 Answers
Issue with Rotation behaviour of PID Controller when rotating to look at mouse position 0 Answers