- Home /
Third person animation
Hi everyone.
i have some problem with this third person animation (from the build in thirdpersonshooter.js (unity assets)) and i'm just going to list it
How to make the player hand look at the mouse position when pressing right click ?
After the player presses right click, the MouseOrbit will zoom in and the character animation plays readypose (_animation[readypose.name].layer = 1; and _animation.CrossFade(readypose.name);). but the character hand won't move according to the mouse position.
function ReadyToShoot(){ //Invoked when player presses right click
_characterState = CharacterState.Ready; //plays readypose on Update function
x += Input.GetAxis("Mouse X") * 60 * 0.02;
y -= Input.GetAxis("Mouse Y") * 60 * 0.02;
var rotation = Quaternion.Euler(y, x, 0);
hand.LookAt(rotation.eulerAngles); //move if i attached hand to unskinned object, can't move if i attached to skinned / animationed transform.
if(Input.GetButton("Fire1")){
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray) && !IsMoving() && !IsJumping()){
ApplyShooting();
}
}
thanks for answering
Comment
Your answer
Follow this Question
Related Questions
Wrong rotation while swimming 2 Answers
Door opening in the wrong direction..... 0 Answers
Get slerp to work just as LookAt(,Vector3.right) does 1 Answer
Simple Script Problem 1 Answer