Jump to content
  • Advertisement
Sign in to follow this  
lucky6969b

About changing the orientation handedness of OpenTissue

This topic is 586 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've tried the following, but didn't know if this works or not But it seems not working... Thanks Jack
void convertPosHandedness(D3DXVECTOR3& p)
{
    p.z = -p.z;
}

void SkeletalChain::setOrientation(const D3DXQUATERNION& orientation)
{
	mChain.only_position() = false;		 
		 
	mOrientation = orientation; 		 	

	D3DXVECTOR3 vecx(1, 0, 0);
	D3DXVECTOR3 vecy(0, 1, 0);

	D3DXMATRIX matTemp;
	D3DXMatrixTransformation(&matTemp, NULL, NULL,NULL, NULL, &mOrientation, NULL);
	D3DXVec3TransformCoord(&vecx, &vecx, &matTemp);
	D3DXVec3TransformCoord(&vecy, &vecy, &matTemp);		 

	convertPosHandedness(vecx);
	convertPosHandedness(vecy);
		 
	mChain.x_global()[0] = vecx.x;
	mChain.x_global()[1] = vecx.y;
	mChain.x_global()[2] = vecx.z;

		 
	mChain.y_global()[0] = vecy.x;
	mChain.y_global()[1] = vecy.y;
	mChain.y_global()[2] = vecy.z;		 
 
}

Share this post


Link to post
Share on other sites
Advertisement

I'm sorry about the downvote, but the Opentissue site is down

So I can't post the link of the site..

Like this

FYI

http://www.ogre3d.org/forums/viewtopic.php?f=5&t=47172&p=327482&hilit=OgreTissue#p327482

 

opentissue.org

 

Update:

I still can't figure out how to set the orientations of the end effector.

The IK system works if I didn't use the orientation setter.

But once I use it, it starts to go wild.

 

I even tried

m_left_chain->setTargetOrientation(m_left_chain->getOrientation());

where

void SkeletalChain::setTargetOrientation(const D3DXQUATERNION& orientation)
    {
        mChain.only_position() = false;        
        // dx
        mOrientation = orientation;        

        D3DXVECTOR3 vecx(1, 0, 0);
        D3DXVECTOR3 vecy(0, 1, 0);

        D3DXMATRIX matTemp;
        D3DXMatrixTransformation(&matTemp, NULL, NULL,NULL, NULL, &mOrientation, NULL);
        D3DXVec3TransformCoord(&vecx, &vecx, &matTemp);
        D3DXVec3TransformCoord(&vecy, &vecy, &matTemp);        

        //convertPosHandedness(vecx);
        //convertPosHandedness(vecy);
        
        mChain.x_global()[0] = vecx.x;
        mChain.x_global()[1] = vecx.y;
        mChain.x_global()[2] = vecx.z;

        
        mChain.y_global()[0] = vecy.x;
        mChain.y_global()[1] = vecy.y;
        mChain.y_global()[2] = vecy.z;        
 
    }
 
 
D3DXQUATERNION getOrientation() const
        {
            
            D3DXVECTOR3 a1(mChain.x_global()[0], mChain.x_global()[1], mChain.x_global()[2]);
            D3DXVECTOR3 a2(mChain.y_global()[0], mChain.y_global()[1], mChain.y_global()[2]);

            D3DXQUATERNION q1, q2, q3;

            D3DXQuaternionRotationAxis(&q1, &a1, 0.0f);
            D3DXQuaternionRotationAxis(&q2, &a2, 0.0f);



             q3 = q1 * q2;

            // convertQuatHandedness(q3);

             return q3;

            
            //return mOrientation;
        }
 

It's still going crazy...

Edited by lucky6969b

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!