public static void Forward(this GuideObject go, float dist)
        {
            if (!go.IsLimb())
            {
                return;
            }
            var rotater = FkCharaMgr.BuildFkJointRotater(go);

            if (rotater == null)
            {
                return;
            }
            rotater.Forward(dist);
        }
        public static void Normals(this GuideObject go, float angle)
        {
            if (!go.IsLimb())
            {
                return;
            }
            var rotater = FkCharaMgr.BuildFkJointRotater(go);

            if (rotater == null)
            {
                return;
            }
            rotater.Normals(angle);
        }
Beispiel #3
0
        private void Move(Vector3 delta)
        {
            Camera camera = MainCamera();

            if (camera == null)
            {
                return;
            }
            var go = Context.GuideObjectManager().selectObject;

            if (go == null || !go.IsLimb())
            {
                return;
            }

            Vector3 vector31 = new Vector3(Screen.width * 0.5f, Screen.height * 0.5f, Input.mousePosition.z);
            Ray     ray      = camera.ScreenPointToRay(vector31);

            ray.direction = new Vector3(ray.direction.x, 0, ray.direction.z);
            Vector3 vector32 = ray.direction * -1 * delta.z;

            ray.direction = Quaternion.LookRotation(ray.direction) * Vector3.right;
            Vector3 vector33 = vector32 + ray.direction * -1 * delta.x;

            vector33.y = delta.y;
            delta      = vector33;
            delta      = delta * 20.0f;
            if (Input.GetKeyDown(KeyCode.LeftShift))
            {
                delta = delta / 4;
            }

            var rotater = FkCharaMgr.BuildFkJointRotater(go);

            rotater.MoveTo(go.transformTarget.position + delta);
        }
        private void Rotate()
        {
            if (Context.GuideObjectManager() == null)
            {
                return;
            }
            var go = Context.GuideObjectManager().selectObject;

            if (go == null)
            {
                return;
            }
            if (!go.IsLimb())
            {
                return;
            }

            float angle = 1.0f;
            float dist  = 0.02f;

            if (Input.GetKey(KeyCode.LeftShift))
            {
                angle /= 4;
                dist  /= 4;
            }
            if (Input.GetKey(KeyCode.X) && Input.GetMouseButton(0))
            {
                var rotater = FkCharaMgr.BuildFkJointRotater(go);
                if (rotater == null)
                {
                    return;
                }
                rotater.Forward(dist);
            }
            else if (Input.GetKey(KeyCode.X) && Input.GetMouseButton(1))
            {
                var rotater = FkCharaMgr.BuildFkJointRotater(go);
                if (rotater == null)
                {
                    return;
                }
                rotater.Forward(-dist);
            }
            //
            else if (Input.GetKey(KeyCode.C) && Input.GetMouseButton(0))
            {
                var rotater = FkCharaMgr.BuildFkJointRotater(go);
                if (rotater == null)
                {
                    return;
                }
                rotater.Tangent(angle);
            }
            else if (Input.GetKey(KeyCode.C) && Input.GetMouseButton(1))
            {
                var rotater = FkCharaMgr.BuildFkJointRotater(go);
                if (rotater == null)
                {
                    return;
                }
                rotater.Tangent(-angle);
            }
            //
            else if (Input.GetKey(KeyCode.V) && Input.GetMouseButton(0))
            {
                var rotater = FkCharaMgr.BuildFkJointRotater(go);
                if (rotater == null)
                {
                    return;
                }
                rotater.Normals(angle);
            }
            else if (Input.GetKey(KeyCode.V) && Input.GetMouseButton(1))
            {
                var rotater = FkCharaMgr.BuildFkJointRotater(go);
                if (rotater == null)
                {
                    return;
                }
                rotater.Normals(-angle);
            }
            //
            else if (Input.GetKey(KeyCode.B) && Input.GetMouseButton(0))
            {
                var rotater = FkCharaMgr.BuildFkJointRotater(go);
                if (rotater == null)
                {
                    return;
                }
                rotater.Revolution(angle);
            }
            else if (Input.GetKey(KeyCode.B) && Input.GetMouseButton(1))
            {
                var rotater = FkCharaMgr.BuildFkJointRotater(go);
                if (rotater == null)
                {
                    return;
                }
                rotater.Revolution(-angle);
            }
        }