mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-02 06:45:33 +00:00
rotation are updated in the physis system
This commit is contained in:
parent
26d6c9453c
commit
d8051095d6
2 changed files with 15 additions and 6 deletions
|
@ -288,17 +288,26 @@ namespace MWWorld
|
||||||
|
|
||||||
void PhysicsSystem::rotateObject (const std::string& handle, const Ogre::Quaternion& rotation)
|
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
|
// TODO very dirty hack to avoid crash during setup -> needs cleaning up to allow
|
||||||
// start positions others than 0, 0, 0
|
// start positions others than 0, 0, 0
|
||||||
act->setRotation(btQuaternion(rotation.x, rotation.y, rotation.z, rotation.w));
|
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)
|
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()
|
bool PhysicsSystem::toggleCollisionMode()
|
||||||
|
|
|
@ -625,9 +625,6 @@ namespace MWWorld
|
||||||
{
|
{
|
||||||
MWWorld::Class::get(ptr).adjustRotation(ptr,x,y,z);
|
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)
|
if(WorldAxis)
|
||||||
{
|
{
|
||||||
ptr.getRefData().getBaseNode()->rotate(Ogre::Vector3::UNIT_X,Ogre::Degree(x));
|
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] = rx.valueRadians();
|
||||||
ptr.getRefData().getPosition().rot[0] = ry.valueRadians();
|
ptr.getRefData().getPosition().rot[0] = ry.valueRadians();
|
||||||
ptr.getRefData().getPosition().rot[0] = rz.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
|
//ptr.getRefData().getBaseNode()->rotate(ptr.getRefData().getBaseNode()->get
|
||||||
//mPhysics->scaleObject( Class::get(ptr).getId(ptr), scale );
|
//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);
|
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 roty(Ogre::Degree(y),Ogre::Vector3::UNIT_Y);
|
||||||
Ogre::Quaternion rotz(Ogre::Degree(z),Ogre::Vector3::UNIT_Z);
|
Ogre::Quaternion rotz(Ogre::Degree(z),Ogre::Vector3::UNIT_Z);
|
||||||
ptr.getRefData().getBaseNode()->setOrientation(rotx*roty*rotz);
|
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
|
void World::indexToPosition (int cellX, int cellY, float &x, float &y, bool centre) const
|
||||||
|
|
Loading…
Reference in a new issue