コード例 #1
0
ファイル: HandStand.cs プロジェクト: JerryAJIAN/MMMDocument
        public void Run(CommandArgs e)  //命令插件核心,按下按钮后执行的部分
        {
            MessageBox.Show(ApplicationForm, "这是一次倒立的实践!");
            BoneCollection bones = Scene.ActiveModel.Bones;

            for (int i = 0; i < bones.Count; i++)
            {
                if (bones[i].Name != "全ての親")
                {
                    continue;
                }
                MotionLayerCollection layers = bones[i].Layers;
                for (int i2 = 0; i2 < layers.Count; i2++)
                {
                    MotionFrameCollection frameDates = layers[i2].Frames;
                    for (int f = 0; f < 30; f++)
                    {
                        MotionFrameData data = new MotionFrameData();
                        data.FrameNumber = f * 10;
                        data.Quaternion  = Quaternion.RotationAxis(new Vector3(0, 0, 1), 6 * f);

                        //Vector3 vector = frameDatas.GetFrame(f * 10).Position;
                        //vector.Y += 10;
                        frameDates.AddKeyFrame(data);
                    }
                }
            }
        }
コード例 #2
0
        Matrix GetMotion(BoneCollection bones, Bone bone)
        {
            var b  = bones[bone.ParentBoneID];
            var rt = Matrix.RotationQuaternion(b.CurrentLocalMotion.Rotation) * Matrix.Translation(b.CurrentLocalMotion.Move + b.InitialPosition);

            if (b.ParentBoneID != -1)
            {
                rt *= GetMotion(bones, b);
            }

            return(rt);
        }
コード例 #3
0
    void Start()
    {
        trans = transform;
        Transform armature = trans.FindChild("Armature");

        Bones = new BoneCollection(armature);

        if (Path == "")
        {
            Genes = new List <Gene>();
        }
        else
        {
            if (Resource)
            {
                LoadDNAResource(Path);
            }
            else
            {
                LoadDNAFile(Path);
            }
        }
    }
コード例 #4
0
        Matrix GetMotion(BoneCollection bones, Bone bone)
        {
            var b = bones[bone.ParentBoneID];
            var rt = Matrix.RotationQuaternion(b.CurrentLocalMotion.Rotation) * Matrix.Translation(b.CurrentLocalMotion.Move + b.InitialPosition);

            if (b.ParentBoneID != -1)
                rt *= GetMotion(bones, b);

            return rt;
        }