void ASmrActor::TransformChildren(UPoseableMeshComponent* mesh, SMRJoint* bone) { //Recursively apply transformations to all children of this bone std::vector<uint32> children = skeleton.getJointChildren(bone->getName()); for (int i = 0; i < children.size(); ++i) { TransformBone(mesh, skeleton.getJoint(children[i])); TransformChildren(mesh, skeleton.getJoint(children[i])); } }
void ASmrActor::PoseCharacterLocalSpace(UPoseableMeshComponent* mesh) { //Initialize skeleton skeleton = m_motion.getSkeleton(m_frameIndex); skeleton.setRotationOrder(TRANSLATIONFIRST); skeleton.setMode(SMRModeType::RELATIVEMODE); //Transform root bone SMRJoint* rootJoint = skeleton.getJointByName("root"); TransformBone(mesh, rootJoint); //Recursively transform children TransformChildren(mesh, rootJoint); }
public func Construction() { this.MeshTransformation = Trans_Rotate(Random(360), 0, 1, 0); var sibling = nil; for (var bone in ["bone1", "bone2", "bone3"]) { var transformation; var rand = Random(2); if (rand == 0) transformation = Trans_Rotate(RandomX(-20, 20), 1, 0, 0); else if(rand == 1) transformation = Trans_Rotate(RandomX(-20, 20), 0, 0, 1); sibling = TransformBone(bone, transformation, 1, Anim_Const(1000), sibling); } }