1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-10 21:40:15 +00:00

Switching back to old scaling

This commit is contained in:
Jason Hooks 2012-06-19 13:28:06 -04:00
parent 4d55ecfdbe
commit 86d8a07fc7
2 changed files with 15 additions and 12 deletions

View File

@ -213,6 +213,8 @@ namespace MWWorld
if(it->first == "player"){ if(it->first == "player"){
coord = playerphysics->ps.origin; 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) void PhysicsSystem::scaleObject (const std::string& handle, float scale)
{ {
/*
if(handleToMesh.find(handle) != handleToMesh.end()) if(handleToMesh.find(handle) != handleToMesh.end())
{ {
btTransform transform = mEngine->getRigidBody(handle)->getWorldTransform(); 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::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()); Ogre::Vector3 vec = Ogre::Vector3(transform.getOrigin().getX(), transform.getOrigin().getY(), transform.getOrigin().getZ());
addObject(handle, handleToMesh[handle], quat, scale, vec); addObject(handle, handleToMesh[handle], quat, scale, vec);
} }*/
} }
bool PhysicsSystem::toggleCollisionMode() bool PhysicsSystem::toggleCollisionMode()

View File

@ -324,24 +324,24 @@ namespace Physic
RigidBody* PhysicEngine::createRigidBody(std::string mesh,std::string name,float scale) RigidBody* PhysicEngine::createRigidBody(std::string mesh,std::string name,float scale)
{ {
/*char uniqueID[8]; char uniqueID[8];
sprintf( uniqueID, "%07.3f", scale ); sprintf( uniqueID, "%07.3f", scale );
std::string sid = uniqueID; std::string sid = uniqueID;
std::string outputstring = mesh + uniqueID + "\"|";*/ std::string outputstring = mesh + uniqueID + "\"|";
//std::cout << "The string" << outputstring << "\n"; //std::cout << "The string" << outputstring << "\n";
//get the shape from the .nif //get the shape from the .nif
mShapeLoader->load(mesh,"General"); mShapeLoader->load(outputstring,"General");
BulletShapeManager::getSingletonPtr()->load(mesh,"General"); BulletShapeManager::getSingletonPtr()->load(outputstring,"General");
BulletShapePtr shape = BulletShapeManager::getSingleton().getByName(mesh,"General"); BulletShapePtr shape = BulletShapeManager::getSingleton().getByName(outputstring,"General");
//shape->Shape->setLocalScaling(); shape->Shape->setLocalScaling( btVector3(scale,scale,scale));
btScaledBvhTriangleMeshShape* scaled = new btScaledBvhTriangleMeshShape(dynamic_cast<btBvhTriangleMeshShape*> (shape->Shape), btVector3(scale,scale,scale)); //btScaledBvhTriangleMeshShape* scaled = new btScaledBvhTriangleMeshShape(dynamic_cast<btBvhTriangleMeshShape*> (shape->Shape), btVector3(scale,scale,scale));
//create the motionState //create the motionState
CMotionState* newMotionState = new CMotionState(this,name); CMotionState* newMotionState = new CMotionState(this,name);
//create the real body //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); RigidBody* body = new RigidBody(CI,name);
body->collide = shape->collide; body->collide = shape->collide;
return body; return body;
@ -398,16 +398,16 @@ namespace Physic
if (it != RigidBodyMap.end() ) if (it != RigidBodyMap.end() )
{ {
RigidBody* body = it->second; RigidBody* body = it->second;
btScaledBvhTriangleMeshShape* scaled = dynamic_cast<btScaledBvhTriangleMeshShape*> (body->getCollisionShape()); //btScaledBvhTriangleMeshShape* scaled = dynamic_cast<btScaledBvhTriangleMeshShape*> (body->getCollisionShape());
if(body != NULL) if(body != NULL)
{ {
delete body; delete body;
} }
if(scaled != NULL) /*if(scaled != NULL)
{ {
delete scaled; delete scaled;
} }*/
RigidBodyMap.erase(it); RigidBodyMap.erase(it);
} }
} }