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); } } } }
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); }
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); } } }
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; }