From 86d8a07fc71798927e0abfbd9f1deff1202da6e3 Mon Sep 17 00:00:00 2001 From: Jason Hooks Date: Tue, 19 Jun 2012 13:28:06 -0400 Subject: [PATCH] Switching back to old scaling --- apps/openmw/mwworld/physicssystem.cpp | 5 ++++- libs/openengine/bullet/physic.cpp | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/apps/openmw/mwworld/physicssystem.cpp b/apps/openmw/mwworld/physicssystem.cpp index 530881ec9..94f39da7d 100644 --- a/apps/openmw/mwworld/physicssystem.cpp +++ b/apps/openmw/mwworld/physicssystem.cpp @@ -213,6 +213,8 @@ namespace MWWorld if(it->first == "player"){ coord = playerphysics->ps.origin; + //playerphysics->ps.speed = 480.0f; + //std::cout << "Position" << coord << "\n"; } @@ -300,6 +302,7 @@ namespace MWWorld void PhysicsSystem::scaleObject (const std::string& handle, float scale) { + /* if(handleToMesh.find(handle) != handleToMesh.end()) { btTransform transform = mEngine->getRigidBody(handle)->getWorldTransform(); @@ -308,7 +311,7 @@ namespace MWWorld Ogre::Quaternion quat = Ogre::Quaternion(transform.getRotation().getW(), transform.getRotation().getX(), transform.getRotation().getY(), transform.getRotation().getZ()); Ogre::Vector3 vec = Ogre::Vector3(transform.getOrigin().getX(), transform.getOrigin().getY(), transform.getOrigin().getZ()); addObject(handle, handleToMesh[handle], quat, scale, vec); - } + }*/ } bool PhysicsSystem::toggleCollisionMode() diff --git a/libs/openengine/bullet/physic.cpp b/libs/openengine/bullet/physic.cpp index 1dc38475d..6a3f22565 100644 --- a/libs/openengine/bullet/physic.cpp +++ b/libs/openengine/bullet/physic.cpp @@ -324,24 +324,24 @@ namespace Physic RigidBody* PhysicEngine::createRigidBody(std::string mesh,std::string name,float scale) { - /*char uniqueID[8]; + char uniqueID[8]; sprintf( uniqueID, "%07.3f", scale ); std::string sid = uniqueID; - std::string outputstring = mesh + uniqueID + "\"|";*/ + std::string outputstring = mesh + uniqueID + "\"|"; //std::cout << "The string" << outputstring << "\n"; //get the shape from the .nif - mShapeLoader->load(mesh,"General"); - BulletShapeManager::getSingletonPtr()->load(mesh,"General"); - BulletShapePtr shape = BulletShapeManager::getSingleton().getByName(mesh,"General"); - //shape->Shape->setLocalScaling(); - btScaledBvhTriangleMeshShape* scaled = new btScaledBvhTriangleMeshShape(dynamic_cast (shape->Shape), btVector3(scale,scale,scale)); + mShapeLoader->load(outputstring,"General"); + BulletShapeManager::getSingletonPtr()->load(outputstring,"General"); + BulletShapePtr shape = BulletShapeManager::getSingleton().getByName(outputstring,"General"); + shape->Shape->setLocalScaling( btVector3(scale,scale,scale)); + //btScaledBvhTriangleMeshShape* scaled = new btScaledBvhTriangleMeshShape(dynamic_cast (shape->Shape), btVector3(scale,scale,scale)); //create the motionState CMotionState* newMotionState = new CMotionState(this,name); //create the real body - btRigidBody::btRigidBodyConstructionInfo CI = btRigidBody::btRigidBodyConstructionInfo(0,newMotionState,scaled); + btRigidBody::btRigidBodyConstructionInfo CI = btRigidBody::btRigidBodyConstructionInfo(0,newMotionState,shape->Shape); RigidBody* body = new RigidBody(CI,name); body->collide = shape->collide; return body; @@ -398,16 +398,16 @@ namespace Physic if (it != RigidBodyMap.end() ) { RigidBody* body = it->second; - btScaledBvhTriangleMeshShape* scaled = dynamic_cast (body->getCollisionShape()); + //btScaledBvhTriangleMeshShape* scaled = dynamic_cast (body->getCollisionShape()); if(body != NULL) { delete body; } - if(scaled != NULL) + /*if(scaled != NULL) { delete scaled; - } + }*/ RigidBodyMap.erase(it); } }