Hi,
I’ve got a problem that I hope you can help me with, I’m using Aim IK to aim a weapon at the player (all works fine) then I’m using Mecanim IK to re target the left hand on the weapon when it’s aimed at the player, the aim script …
function LateUpdate(){
if((globalVarsScript.futureSoldierType1Alive[soldierNumber]) && (!knockedDown)){
if(seePlayer){
theLookAtPosition = player.position + transform.up * 0.2;
ikAim.solver.IKPosition = theLookAtPosition;
if(currentStateLayer02.nameHash == reloadState){
lerpWieghtdown();
}else lerpWieghtUp();
ikAim.solver.IKPositionWeight = lookWeight;
}else{
lerpWieghtdown();
ikAim.solver.IKPositionWeight = lookWeight;
}
}else{
ikAim.solver.IKPositionWeight = 0;
}
}
And the Mecanim IK code …
function OnAnimatorIK() {
if(seePlayer) {
if(currentStateLayer02.nameHash == reloadState){
lerpWieghtdown();
}else lerpWieghtUp();
_animator.SetIKPositionWeight(AvatarIKGoal.LeftHand,lookWeight);
_animator.SetIKRotationWeight(AvatarIKGoal.LeftHand,lookWeight);
if(leftHandTarget != null) {
_animator.SetIKPosition(AvatarIKGoal.LeftHand,leftHandTarget.position);
_animator.SetIKRotation(AvatarIKGoal.LeftHand,leftHandTarget.rotation);
}
}else{
_animator.SetIKPositionWeight(AvatarIKGoal.LeftHand,0);
_animator.SetIKRotationWeight(AvatarIKGoal.LeftHand,0);
}
}
When the Mecanim IK code is run the left hand moves to the effector but when the weapon points at the player the hand does not move down with the effector (as seen in the video) is this something to do with the call order?
I’d appreciate any help you can give me, thank you.
What I have just noticed is the bullet cases being ejected on the other side are being ejected above the weapon, so the transform positions of the bullet cases and the hand effector are not changing when the weapon is aimed at the player with the Aim IK … But if you look the transform position of the hand effector looks to be moving with the weapon but not returning new position X,Y,Z … Why would this happen ?