Sign in to follow this  
lucky6969b

About changing the orientation handedness of OpenTissue

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this