I have a character with a rifle and I need to aim the rifle to a target ( the cube in the bottom left )
I'm using animator.SetLookAtPosition(AimTarget.position);
and then the head ( animator.GetBoneTransform(HumanBodyBones.Head) ) is pointing directly to the target - it's the green line
how can I manipluate the lookPosioin vector so the barrel of the weapon (red line) will be pointing directly to the target (insted of the head)
animator.SetLookAtWeight(weight: 1f, bodyWeight: 1f, headWeight: 1f, eyesWeight: 0f, clampWeight: 0f);
Vector3 lookPosition = AimTarget.position;
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
3 People are following this question.
Mechanim - should be simple, but...
Body Jitter when using SetLookAtWeight
what is the foot ik button for
Mecanim IK problems
Animator and Rigidbody2D Conflicting. Help~