use "bones" to animate a model + OgreXMLConverter

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
ali_lak
Gnoblar
Posts: 13
Joined: Sun Oct 02, 2016 1:34 pm

use "bones" to animate a model + OgreXMLConverter

Post by ali_lak »

Hi
i found how to use "bones" to animate a model. :D
but i need to know names of bones. :?:
Apparently i can to use ogreXmlconverter to create *.xml files from my *.mesh & *.skeleton files and read the name of bones from there.
but when i try to use ogreXmlconverter, and read the names from there and insert in my code i see that the visual studio says the names are incorrect. :cry:
(I have same problem with animations too! :| )
what is the problem?

you can to see my xml file of entity here:

Code: Select all

<skeleton>
    <bones>
        <bone id="0" name="ValveBiped.Bip01_Pelvis">
            <position x="0" y="1.03838" z="0.0143666" />
            <rotation angle="4.71239">
                <axis x="-1" y="-0" z="-0" />
            </rotation>
            <scale x="1" y="1" z="1" />
        </bone>
        <bone id="1" name="ValveBiped.Bip01_L_Thigh">
            <position x="0.104746" y="0" z="0" />
            <rotation angle="4.22162">
                <axis x="0.569096" y="0.566199" z="0.596279" />
            </rotation>
            <scale x="1" y="1" z="1" />
        </bone>
.
.
.
the code is here:

Code: Select all

       
           Bone mRobotBone;
           #region phoneix
            Entity mPhoneixEntity = mSceneMgr.CreateEntity("Phoneix", "phoneix.mesh");
            SceneNode mPhoneixNode = mSceneMgr.RootSceneNode.CreateChildSceneNode("PhoneixNode");
             mPhoneixEntity.SetMaterialName("t_phoenix.tga");
            mPhoneixEntity.DisplaySkeleton = false;
            mPhoneixNode.SetPosition(5750f, 0, 500f);
            mPhoneixNode.Scale(new Vector3(100, 100, 100));
            mPhoneixNode.AttachObject(mPhoneixEntity);
            Skeleton mPhoneixSkeleton = mPhoneixEntity.Skeleton;
            mPhoneixBone =mPhoneixSkeleton.GetBone("ValveBiped.Bip01_L_Thigh");
            mPhoneixBone.SetManuallyControlled(true);
            #endregion phoneix
the error is here:
""Object reference not set to an instance of an object."'

thanks you very much for your answers.
(Note: I'm so sorry for my bad English)
frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 65

Re: use "bones" to animate a model + OgreXMLConverter

Post by frostbyte »

using mogre?
your code looks valid to me( but i've never used mogre )
maybe it's some kind of mogre build issue
make sure you don't have a problem passing strings to and from ogre in general( e.g check if you can get read back an entity name )
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos
ali_lak
Gnoblar
Posts: 13
Joined: Sun Oct 02, 2016 1:34 pm

Re: use "bones" to animate a model + OgreXMLConverter

Post by ali_lak »

Hi, Thanks a lot for your answer.
frostbyte wrote:using mogre?
yes i'm using mogre,
frostbyte wrote:make sure you don't have a problem passing strings to and from ogre in general( e.g check if you can get read back an entity name )
yes i can read back entity names for example to rotate them in FrameListener.
it's true (no problem) for using robot.mesh and call it's bones.
but for my new entity i have that problem.
Thanks again.
(Note: I'm sorry for my bad English!)
frostbyte
Orc Shaman
Posts: 737
Joined: Fri May 31, 2013 2:28 am
x 65

Re: use "bones" to animate a model + OgreXMLConverter

Post by frostbyte »

this does'nt look right
"ValveBiped.Bip01_L_Thigh"
maybe try this instead
"Bip01_L_Thigh"
anyway, you can just create an entiry and iterate over the bones( using Ogre::Skeleton::getBoneIterator )
you can get the bone name directly from ogres Bone object( Bone->getName )....
i don't see a real need for xmlConverter and manual copy but maybe i'm wrong, just suggesting...
the woods are lovely dark and deep
but i have promises to keep
and miles to code before i sleep
and miles to code before i sleep..

coolest videos link( two minutes paper )...
https://www.youtube.com/user/keeroyz/videos
Post Reply