etsuja
12-02-2010 07:26:35
I'm making a game with a sphere world but I'm having trouble making it so the player is always standing with his head outwards from the sphere.
right now I'm doing this:
this works until I try moving up a hill, then my player falls through the ground.
this code is in my force callback btw.
So, I'm thinking I need to use an up vector, but I don't know what to use as an up vector so the players head is always pointing outwards from the sphere.
EDIT- Well I found what to make the up vector:
But my player is still falling through the ground when I try to go up hill.
right now I'm doing this:
bod->getPositionOrientation(bodPos, bodOrient);
player->node->lookAt(Ogre::Vector3(0,0,0), Ogre::Node::TS_WORLD, Ogre::Vector3::NEGATIVE_UNIT_Y);
bod->setPositionOrientation( bodPos, player->node->getOrientation());
this works until I try moving up a hill, then my player falls through the ground.
this code is in my force callback btw.
So, I'm thinking I need to use an up vector, but I don't know what to use as an up vector so the players head is always pointing outwards from the sphere.
EDIT- Well I found what to make the up vector:
OgreNewt::BasicJoints::UpVector uv = OgreNewt::BasicJoints::UpVector(world, bod, player->node->getOrientation().y * Ogre::Vector3::UNIT_Y);
But my player is still falling through the ground when I try to go up hill.