示例#1
0
 private void InnerUpdate()
 {
     if (Input.GetKey(KeyCode.LeftControl) && Input.GetMouseButtonDown(0))
     {
         var           minDist = double.MaxValue;
         FkBone.FkBone minBone = null;
         FkCharaMgr.FindSelectCharas().Foreach(c =>
         {
             c.Bones().Foreach(b =>
             {
                 var screenPoint = CameraMgr.MainCamera().WorldToScreenPoint(b.Transform.position);
                 var dist        = (screenPoint - Input.mousePosition).magnitude;
                 if (dist < minDist)
                 {
                     minDist = dist;
                     minBone = b;
                 }
             });
         });
         if (minBone != null)
         {
             Context.GuideObjectManager().SetSelectObject(minBone.GuideObject, false);
         }
     }
 }
示例#2
0
        private void InnerUpdate()
        {
            if (Input.GetKeyDown(KeyCode.T) && Input.GetKey(KeyCode.LeftControl))
            {
                if (_isLockerEnable)
                {
                    AttachHangMarker();
                }
            }
            else if (Input.GetKeyDown(KeyCode.T))
            {
                if (_isLockerEnable)
                {
                    _isLockerEnable = false;
                    ClearLimbMarker();
                    ClearSelectorMarker();
                    ClearHangMarker();
                    _attachRecords.Clear();
                    _hangRecords.Clear();
                    CameraMgr.Unlock();
                }
                else
                {
                    _isLockerEnable = true;
                    AttachLimbMarker();
                }
                Tracer.Log(_isLockerEnable);
            }
            else if (Input.GetKeyDown(KeyCode.P))
            {
                CameraMgr.Toggle();
            }
            // 移动到Lock的位置
            foreach (var pair in _dicLockRecords)
            {
                var b = pair.Key;
                var r = pair.Value;
                if (b.Transform.position != r.LockedPos && b.GuideObject.IsLimb())
                {
                    FkJointAssist.FkJointRotater(b.GuideObject).MoveTo(r.LockedPos);
                }
                if (b.Transform.rotation != r.LockedRot)
                {
                    b.GuideObject.TurnTo(r.LockedRot);
                }
            }
            _hangRecords.ForEach(r =>
            {
                var vec = r.Pos - r.Bone.Transform.position;
                if (vec != Vector3.zero)
                {
                    r.Bone.Chara.Root.GuideObject.Move(vec);
                }
                if (r.Rot != r.Bone.Transform.rotation)
                {
                    r.Bone.GuideObject.TurnTo(r.Rot);
                }
            });
            _attachRecords.ForEach(r =>
            {
//                if (r.Leader.Transform == r.Follower.Transform)
//                {
//                    var vec = r.Pos - r.Leader.Transform.position;
//                    r.Leader.Chara.Root.GuideObject.Move(vec);
//                }
//                else
//                {
                var target = r.Leader.Transform.position + r.Pos;
                r.Follower.GuideObject.MoveEnd(target);
//                }
            });
        }