public void CreatePosition(Vector3 origin, Vector3 moveDir, bool isMid) // origin = helper위치 ismid = 애니메이션 idle,up { delta = Time.deltaTime; HandlerAnimation(moveDir, isMid); if (!isMid) // can delete { UpdateGoals(premovedir); } else ///ismid first { UpdateGoals(moveDir); premovedir = moveDir; } IKSnapshot ik = CreateSnapshot(origin); CopySnapshot(ref current, ik); SetIkPosition(isMid, goals.lf, current.lf, AvatarIKGoal.LeftFoot); //can delete SetIkPosition(isMid, goals.rf, current.rf, AvatarIKGoal.RightFoot); SetIkPosition(isMid, goals.lh, current.lh, AvatarIKGoal.LeftHand); SetIkPosition(isMid, goals.rh, current.rh, AvatarIKGoal.RightHand); UpdateIKWeight(AvatarIKGoal.LeftFoot, 1); UpdateIKWeight(AvatarIKGoal.LeftHand, 1); UpdateIKWeight(AvatarIKGoal.RightFoot, 1); UpdateIKWeight(AvatarIKGoal.RightHand, 1); }
public void CreatePositions(Vector3 origin, Vector3 moveDir, bool isMid) { delta = Time.deltaTime; HandleAnim(moveDir, isMid); if (!isMid) { UpdateGoals(moveDir); prevMovDir = moveDir; } else { UpdateGoals(prevMovDir); } IKSnapshot ik = CreateSnapshot(origin); CopySnapshot(ref current, ik); SetIKPosition(isMid, goals.lf, current.lf, AvatarIKGoal.LeftFoot); SetIKPosition(isMid, goals.rf, current.rf, AvatarIKGoal.RightFoot); SetIKPosition(isMid, goals.lh, current.lh, AvatarIKGoal.LeftHand); SetIKPosition(isMid, goals.rh, current.rh, AvatarIKGoal.RightHand); UpdateIKWeight(AvatarIKGoal.LeftFoot, 1); UpdateIKWeight(AvatarIKGoal.RightFoot, 1); UpdateIKWeight(AvatarIKGoal.LeftHand, 1); UpdateIKWeight(AvatarIKGoal.RightHand, 1); }
public void CopySnapshot(ref IKSnapshot to, IKSnapshot from) { to.rh = from.rh; to.lh = from.lh; to.lf = from.lf; to.rf = from.rf; }
public void UpdateIKTargets(IKSnapshotType type, bool isLeft) { IKSnapshot snap = GetIKSnapshot(type); Vector3 targetBodyPos = snap.bodyPos; if (isLeft) { targetBodyPos.x = -targetBodyPos.x; } bodyHelper.localPosition = targetBodyPos; if (snap.overrideHeadPosition) { headHelper.localPosition = snap.headPos; } else { headHelper.localPosition = defaultHeadPos; } handHelper.localPosition = snap.handPos; handHelper.localEulerAngles = snap.handEulers; }
public IKSnapshot CreateSnapshot(Vector3 origin) { IKSnapshot r = new IKSnapshot(); r.lh = LocalToWorld(ikBase.lh); r.rh = LocalToWorld(ikBase.rh); r.lf = LocalToWorld(ikBase.lf); r.rf = LocalToWorld(ikBase.rf); return(r); }
public void CreatePositions(Vector3 origin) { IKSnapshot ik = CreateSnapshot(origin); CopySnapshot(ik, ref current); UpdateIKPosition(AvatarIKGoal.LeftFoot, current.lf); UpdateIKPosition(AvatarIKGoal.RightFoot, current.rf); UpdateIKPosition(AvatarIKGoal.LeftHand, current.lh); UpdateIKPosition(AvatarIKGoal.RightHand, current.rh); UpdateIKWeight(AvatarIKGoal.LeftFoot, 1); UpdateIKWeight(AvatarIKGoal.RightFoot, 1); UpdateIKWeight(AvatarIKGoal.LeftHand, 1); UpdateIKWeight(AvatarIKGoal.RightHand, 1); }
public IKSnapshot CreateSnapshot(Vector3 o) { IKSnapshot r = new IKSnapshot(); Vector3 r_lh = LocalToWorld(ikBase.lh); r.lh = ActualPos(r_lh, AvatarIKGoal.LeftHand); Vector3 r_rh = LocalToWorld(ikBase.rh); r.rh = ActualPos(r_rh, AvatarIKGoal.RightHand); Vector3 r_lf = LocalToWorld(ikBase.lf); r.lf = ActualPos(r_lf, AvatarIKGoal.LeftFoot); Vector3 r_rf = LocalToWorld(ikBase.rf); r.rf = ActualPos(r_rf, AvatarIKGoal.RightFoot); return(r); }
public void Init(FreeClimb c, Transform helper) { anim = c.anim; ikBase = c.baseIKsnapshot; h = helper; }
public void Init(FreeClimb c, Transform _helper) { anim = c.anim; ikBase = c.baseIkSnapshot; helper = _helper; }