rotation are updated in the physis system

actorid
gugus 13 years ago
parent 26d6c9453c
commit d8051095d6

@ -288,17 +288,26 @@ namespace MWWorld
void PhysicsSystem::rotateObject (const std::string& handle, const Ogre::Quaternion& rotation)
{
if (OEngine::Physic::PhysicActor* act = mEngine->getCharacter(handle))
if (OEngine::Physic::PhysicActor* act = mEngine->getCharacter(handle))
{
// TODO very dirty hack to avoid crash during setup -> needs cleaning up to allow
// start positions others than 0, 0, 0
act->setRotation(btQuaternion(rotation.x, rotation.y, rotation.z, rotation.w));
}
if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle))
{
body->setWorldTransform(btTransform(btQuaternion(rotation.x, rotation.y, rotation.z, rotation.w),body->getWorldTransform().getOrigin()));
}
}
void PhysicsSystem::scaleObject (const std::string& handle, float scale)
{
if (OEngine::Physic::RigidBody* body = mEngine->getRigidBody(handle))
{
// TODO very dirty hack to avoid crash during setup -> needs cleaning up to allow
// start positions others than 0, 0, 0
//body->setWorldTransform(btTransform().se
}
}
bool PhysicsSystem::toggleCollisionMode()

@ -625,9 +625,6 @@ namespace MWWorld
{
MWWorld::Class::get(ptr).adjustRotation(ptr,x,y,z);
/*ptr.getRefData().getPosition().rot[0] = x;
ptr.getRefData().getPosition().rot[0] = y;
ptr.getRefData().getPosition().rot[0] = z;*/
if(WorldAxis)
{
ptr.getRefData().getBaseNode()->rotate(Ogre::Vector3::UNIT_X,Ogre::Degree(x));
@ -652,11 +649,13 @@ namespace MWWorld
ptr.getRefData().getPosition().rot[0] = rx.valueRadians();
ptr.getRefData().getPosition().rot[0] = ry.valueRadians();
ptr.getRefData().getPosition().rot[0] = rz.valueRadians();
mPhysics->rotateObject(Class::get(ptr).getId(ptr),ptr.getRefData().getBaseNode()->getOrientation());
//ptr.getRefData().getBaseNode()->rotate(ptr.getRefData().getBaseNode()->get
//mPhysics->scaleObject( Class::get(ptr).getId(ptr), scale );
}
void setObjectRotation (Ptr ptr,float x,float y,float z)
void World::setObjectRotation (Ptr ptr,float x,float y,float z)
{
MWWorld::Class::get(ptr).adjustRotation(ptr,x,y,z);
@ -668,6 +667,7 @@ namespace MWWorld
Ogre::Quaternion roty(Ogre::Degree(y),Ogre::Vector3::UNIT_Y);
Ogre::Quaternion rotz(Ogre::Degree(z),Ogre::Vector3::UNIT_Z);
ptr.getRefData().getBaseNode()->setOrientation(rotx*roty*rotz);
mPhysics->rotateObject(Class::get(ptr).getId(ptr),ptr.getRefData().getBaseNode()->getOrientation());
}
void World::indexToPosition (int cellX, int cellY, float &x, float &y, bool centre) const

Loading…
Cancel
Save