forked from teamnwah/openmw-tes3coop
Switching back to old scaling
This commit is contained in:
parent
4d55ecfdbe
commit
86d8a07fc7
2 changed files with 15 additions and 12 deletions
|
@ -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()
|
||||
|
|
|
@ -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<btBvhTriangleMeshShape*> (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<btBvhTriangleMeshShape*> (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<btScaledBvhTriangleMeshShape*> (body->getCollisionShape());
|
||||
//btScaledBvhTriangleMeshShape* scaled = dynamic_cast<btScaledBvhTriangleMeshShape*> (body->getCollisionShape());
|
||||
|
||||
if(body != NULL)
|
||||
{
|
||||
delete body;
|
||||
}
|
||||
if(scaled != NULL)
|
||||
/*if(scaled != NULL)
|
||||
{
|
||||
delete scaled;
|
||||
}
|
||||
}*/
|
||||
RigidBodyMap.erase(it);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue