Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

Mind Calamity

Member Since 23 Dec 2010
Offline Last Active Yesterday, 05:49 PM
-----

Posts I've Made

In Topic: Vector/Quaternion help - pitch bone to direction vector

Yesterday, 05:33 PM

I've kinda solved this myself by adapting the Camera::setDirection code from OGRE to work for my need:
 
Now I have the following code:
Vector3 boneDir = getBoneWorldOrientation(mEntity, mHips) * Vector3::UNIT_Z; //mDirection;
Vector3 dir = mCameraTrans->_getDerivedDirection();

Vector3 zAdjustVec = dir;
zAdjustVec.normalise();

Quaternion targetWorldOrientation;

Vector3 xVec = Vector3::UNIT_Y.crossProduct(zAdjustVec);
xVec.normalise();

Vector3 yVec = zAdjustVec.crossProduct(xVec);
yVec.normalise();

targetWorldOrientation.FromAxes(xVec, yVec, zAdjustVec);

// mTransform is basically the SceneNode of the character, I'm multiplying the target orientation with it's inverse orientation to get it to parent/character-space.
mHips->_setDerivedOrientation(mTransform->_getDerivedOrientation().Inverse() * targetWorldOrientation);
The above code was taken from OgreCamera.cpp, the setDirection function, the part with the fixed yaw axis.
Now, that works... Sorta, I now get this problem at near-90 degree pitch, the orientation kind of flips to the other side, I've made another video to showcase this:
 
 
Any ideas on how to fix this ?

In Topic: Can't seem to bind a class - Compile errors.

31 January 2013 - 03:06 PM

That was such a stupid mistake on my part. Sorry about that. :)

 

I tried so many different ways to bind it, and I tried removing "const" on one of them, and I still got the same result, but this time that was the problem. :)

 

Thanks for the quick reply.


PARTNERS