示例#1
0
            private static Vector3 MapRotation(CoordSystemPart part, CollidingAxis axis)
            {
                Vector3 rotDeg;

                // MMD default capsule: along Y-axis, Y-up
                // MLTD default: "X" (changes with body coord system)
                // ref: http://nw.tsuda.ac.jp/lec/unity5/Humanoid/index-en.html
                switch (part)
                {
                case CoordSystemPart.Torso:
                case CoordSystemPart.Head:
                    rotDeg = new Vector3(0, 0, 0);
                    break;

                case CoordSystemPart.LeftArm:
                    rotDeg = new Vector3(0, 0, -90);
                    break;

                case CoordSystemPart.RightArm:
                    rotDeg = new Vector3(0, 0, 90);
                    break;

                case CoordSystemPart.Legs:
                    rotDeg = new Vector3(180, 0, 0);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(part), part, null);
                }

                var rotRad = rotDeg * Deg2Rad;

                return(rotRad);
            }
示例#2
0
            private static Vector3 MapTranslation(Vector3 v, CoordSystemPart part, CollidingAxis axis)
            {
                Vector3 r;

                switch (part)
                {
                case CoordSystemPart.Torso:
                case CoordSystemPart.Head:
                    r = new Vector3(v.Y, -v.X, -v.Z);
                    break;

                case CoordSystemPart.LeftArm:
                    r = new Vector3(-v.X, v.Y, v.Z);
                    break;

                case CoordSystemPart.RightArm:
                    r = new Vector3(v.X, v.Y, v.Z);
                    break;

                case CoordSystemPart.Legs:
                    r = new Vector3(-v.Z, v.X, v.Y);
                    break;

                case CoordSystemPart.Hair:
                case CoordSystemPart.Skirt:
                case CoordSystemPart.Breasts:
                case CoordSystemPart.Accessories:
                    r = new Vector3(v.Y, -v.X, -v.Z);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(part), part, null);
                }

                return(r);
            }