mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 10:23:56 +00:00
positioning
This commit is contained in:
parent
02bca98e9f
commit
f586f53a42
4 changed files with 27 additions and 9 deletions
|
@ -282,8 +282,11 @@ namespace MWWorld
|
|||
tr.setOrigin(btVector3(position.x,position.y,position.z));
|
||||
body->setWorldTransform(tr);
|
||||
}
|
||||
else
|
||||
else{
|
||||
//For objects that contain a box shape.
|
||||
//Do any such objects exist? Perhaps animated objects?
|
||||
mEngine->boxAdjustExternal(handleToMesh[handle], body, node->getScale().x, position, node->getOrientation());
|
||||
}
|
||||
}
|
||||
if (OEngine::Physic::PhysicActor* act = mEngine->getCharacter(handle))
|
||||
{
|
||||
|
@ -295,7 +298,7 @@ namespace MWWorld
|
|||
}
|
||||
else
|
||||
{
|
||||
act->setPosition(btVector3(position.x,position.y,position.z));
|
||||
act->setPosition(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -637,7 +637,7 @@ namespace MWWorld
|
|||
rot.x = Ogre::Degree(x).valueRadians();
|
||||
rot.y = Ogre::Degree(y).valueRadians();
|
||||
rot.z = Ogre::Degree(z).valueRadians();
|
||||
|
||||
|
||||
if (mRendering->rotateObject(ptr, rot, adjust)) {
|
||||
float *objRot = ptr.getRefData().getPosition().rot;
|
||||
objRot[0] = rot.x, objRot[1] = rot.y, objRot[2] = rot.z;
|
||||
|
|
|
@ -93,10 +93,9 @@ namespace Physic
|
|||
return Ogre::Quaternion(quat.getW(), quat.getX(), quat.getY(), quat.getZ());
|
||||
}
|
||||
|
||||
void PhysicActor::setPosition(const btVector3& pos)
|
||||
void PhysicActor::setPosition(const Ogre::Vector3 pos)
|
||||
{
|
||||
//internalGhostObject->getWorldTransform().setOrigin(pos+mTranslation);
|
||||
//externalGhostObject->getWorldTransform().setOrigin(pos+mTranslation);
|
||||
mEngine->adjustRigidBody(mBody, pos, getRotation(), mBoxScaledTranslation, mBoxRotation);
|
||||
}
|
||||
|
||||
void PhysicActor::setScale(float scale){
|
||||
|
|
|
@ -51,7 +51,8 @@ namespace Physic
|
|||
};
|
||||
|
||||
/**
|
||||
* A physic Actor use a modifed KinematicCharacterController taken in the bullet forum.
|
||||
* A physic actor uses a rigid body based on box shapes.
|
||||
* Pmove is used to move the physic actor around the dynamic world.
|
||||
*/
|
||||
class PhysicActor
|
||||
{
|
||||
|
@ -82,15 +83,29 @@ namespace Physic
|
|||
|
||||
bool getCollisionMode();
|
||||
|
||||
/**
|
||||
* This returns the visual position of the PhysicActor (used to position a scenenode).
|
||||
* Note - this is different from the position of the contained mBody.
|
||||
*/
|
||||
Ogre::Vector3 getPosition(void);
|
||||
|
||||
/**
|
||||
* Returns the visual orientation of the PhysicActor
|
||||
*/
|
||||
Ogre::Quaternion getRotation(void);
|
||||
|
||||
void setPosition(const btVector3& pos);
|
||||
/**
|
||||
* Sets the position of mBody from a visual position input.
|
||||
* For most cases this should not be used. We should instead let pmove move the PhysicActor around for us
|
||||
*/
|
||||
void setPosition(const Ogre::Vector3 pos);
|
||||
|
||||
/**
|
||||
* Sets the scale of the PhysicActor
|
||||
*/
|
||||
void setScale(float scale);
|
||||
|
||||
std::string mName;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
@ -101,6 +116,7 @@ namespace Physic
|
|||
bool collisionMode;
|
||||
std::string mMesh;
|
||||
PhysicEngine* mEngine;
|
||||
std::string mName;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue