Matrixes??
So i only have to set a matrix for the moon if i want it to rotate around itself or do i have to set the same matrix as the center planet?
Do i have to use the getRelativeTransformation() = matrix command to set the matrix of the moon so that it rotates around itself or do i have to use getAbsoluteTransformation() = matrix?
Do i have to use the getRelativeTransformation() = matrix command to set the matrix of the moon so that it rotates around itself or do i have to use getAbsoluteTransformation() = matrix?
its simple like this: if you manypulate parent (in any way) you manipulate its childs and theyr childs ...its like limbs of model.
If you have parent and child and you rotate parent, child is rotated around parents centre and same angle like parent ...like limb would do. But if you rotate only child than it is rotated around its own centre and parent is unafected.
If you have parent and child and you rotate parent, child is rotated around parents centre and same angle like parent ...like limb would do. But if you rotate only child than it is rotated around its own centre and parent is unafected.
Well i think the matrices don't like me ^^ i just can get two object to work(md3 loader) if i add the head then it moves completely wrong it rotates right but if the body falls onto the floor and doesn't stand anymore the head is still a bit above the body and the head is not where it should be (shoulders) it is somwhere around the ass of the model the body just moves fine and the legs are the main parent like in our example the earth
and now for the main part:
if i add the following to the main loop:
then the body translates correctly but the head still doesn't do what he should and if i use the upper->getRelativeTr... then the body doesn't translate then it just goes up and down like without the code
if i add the same for the head the head just turns around it's own axis(absolute) or does nothing(Relative) like the body
Code: Select all
scene::ISceneNode* upper_n = lower->getMD3TagNode("tag_torso");
upper_n->setParent(lower);
lower->updateMD3TagNode("tag_torso"); // here he updates the matrix the first time because the matrix will change during animation
upper->setPosition(upper_n->getAbsolutePosition());
upper_n->addChild(upper);
scene::ISceneNode* head_n = smgr->addEmptySceneNode(upper);
head_n->setPosition(core::vector3df(0,0,15));
head_n->addChild(head);
Code: Select all
lower->updateMD3TagNode("tag_torso"); // here he updates the matrix of the tag every time he runs through the while loop
Code: Select all
upper->getAbsoluteTransformation() = upper_n->getAbsoluteTransformation();
if i add the same for the head the head just turns around it's own axis(absolute) or does nothing(Relative) like the body
BTW this is the Code that set's the matrix for each frame, it is called one time when the mesh is loaded and reads in all the matrices:
Code: Select all
tag.Name = Tags.Name;
tag.Origin = core::vector3df(Tags.Postition[0],Tags.Postition[1],Tags.Postition[2]);
tag.Rotation[0] = core::vector3df(Tags.Rotation[0][0],Tags.Rotation[0][1],Tags.Rotation[0][2]);
tag.Rotation[1] = core::vector3df(Tags.Rotation[1][0],Tags.Rotation[1][1],Tags.Rotation[1][2]);
tag.Rotation[2] = core::vector3df(Tags.Rotation[2][0],Tags.Rotation[2][1],Tags.Rotation[2][2]);
tag.Transformation.makeIdentity ();
tag.Transformation (0, 0) = tag.Rotation[0].X;
tag.Transformation (0, 1) = tag.Rotation[1].X;
tag.Transformation (0, 2) = tag.Rotation[2].X;
tag.Transformation (0, 3) = tag.Origin.X;
tag.Transformation (1, 0) = tag.Rotation[0].Y;
tag.Transformation (1, 1) = tag.Rotation[1].Y;
tag.Transformation (1, 2) = tag.Rotation[2].Y;
tag.Transformation (1, 3) = tag.Origin.Y;
tag.Transformation (2, 0) = tag.Rotation[0].Z;
tag.Transformation (2, 1) = tag.Rotation[1].Z;
tag.Transformation (2, 2) = tag.Rotation[2].Z;
tag.Transformation (2, 3) = tag.Origin.Z;
tag.Transformation (3, 0) = 0;
tag.Transformation (3, 1) = 0;
tag.Transformation (3, 2) = 0;
tag.Transformation (3, 3) = 1;
TagData[numtags].push_back(tag);