You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
saigumi
Posts: 921 Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:
Post
by saigumi » Sat Feb 21, 2004 2:34 pm
I'm attempting to add objects to a sceneNode based on the joint of an MS3D model.
However, it looks like I'm not actually retrieving the matrix even though the ms3d mesh has joints. A copy of the meshes using in the example are at
http://www.saigumi.net/test_mesh.zip
Anyone see what I'm doing wrong?
Code: Select all
irr::scene::IAnimatedMeshMS3D* tempMesh = (irr::scene::IAnimatedMeshMS3D*)smgr->getMesh("chibi_man.ms3d");
irr::core::matrix4* tempMatrix = tempMesh->getMatrixOfJoint(tempMesh->getJointCount(),tempMesh->getFrameCount());
irr::scene::ISceneNode* gun = smgr->addAnimatedMeshSceneNode(smgr->getMesh("gun01.ms3d"),
Object[ObjectCount].Core,-1,
tempMatrix->getTranslation());
tempMatrix->getRotationDegrees(),
irr::core::vector3df(1,1,1));
Crud, how do I do this again?
niko
Site Admin
Posts: 1759 Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:
Post
by niko » Sat Feb 21, 2004 6:17 pm
Hm, maybe it would work better with something like that:
Code: Select all
tempMesh->getMatrixOfJoint(tempMesh->getJointCount()-1,tempMesh->getFrameCount()-1);
or that:
saigumi
Posts: 921 Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:
Post
by saigumi » Sat Feb 21, 2004 10:06 pm
Tried it, it sort of worked.
I had to create at least one frame of animation in the ms3d for it to work. After adding the keyframe, the model looked like the X one you dropped in a shredder, but it did find a joint.
So, I tried it out on tiny (from the DX tutorials) Calling this bombs out when attempting getTranslation or getRotation.
Code: Select all
irr::scene::IAnimatedMeshX* tempMesh = (irr::scene::IAnimatedMeshX*)smgr->getMesh("tiny.x");
irr::s32 tempct = tempMesh->getJointCount();
tempct = tempMesh->getFrameCount();
irr::core::matrix4* tempMatrix = tempMesh->getMatrixOfJoint(0,0);
irr::scene::ISceneNode* gun = smgr->addAnimatedMeshSceneNode(smgr->getMesh("gun01.ms3d"),
Object[ObjectCount].Core,-1,
tempMatrix->getTranslation(),
tempMatrix->getRotationDegrees(),
irr::core::vector3df(1,1,1));
Crud, how do I do this again?
saigumi
Posts: 921 Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:
Post
by saigumi » Sun Feb 22, 2004 2:06 am
Got it! My model was just borked. BAD.
The zombie doing the John Woo style dive on the left has a gun in his hand. (the black splotch that almost matches his panths)
Another gun can sort of be seen as the black splotch just to the right of him
Every frame, I just need to update the position by calling
Code: Select all
irr::scene::IAnimatedMeshX* tempMesh = (irr::scene::IAnimatedMeshX*)smgr->getMesh("zombie02.ms3d");
irr::core::matrix4* tempMatrix = tempMesh->getMatrixOfJoint(tempMesh->getJointNumber("Joint13"),player->getFrameNr());
irr::core::vector3df tempRot = tempMatrix->getRotationDegrees();
tempRot.X += 90.0f;
gun->setPosition(tempMatrix->getTranslation());
gun->setRotation(tempRot);
Last edited by
saigumi on Sun Feb 22, 2004 5:07 am, edited 1 time in total.
Crud, how do I do this again?
Robomaniac
Posts: 602 Joined: Sat Aug 23, 2003 2:03 am
Location: Pottstown, PA
Contact:
Post
by Robomaniac » Sun Feb 22, 2004 2:12 am
cool, very helpful for third person
keless
Posts: 805 Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA
Post
by keless » Mon Feb 23, 2004 2:54 am
excellent, i was starting to think about this for Equiped items in IrrLichtRPG
a screen cap is worth 0x100000 DWORDS