mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-09 21:42:13 +00:00
Deleting scaled shapes; scaleObject()
This commit is contained in:
parent
33fe80723c
commit
4d55ecfdbe
@ -300,7 +300,15 @@ namespace MWWorld
|
||||
|
||||
void PhysicsSystem::scaleObject (const std::string& handle, float scale)
|
||||
{
|
||||
|
||||
if(handleToMesh.find(handle) != handleToMesh.end())
|
||||
{
|
||||
btTransform transform = mEngine->getRigidBody(handle)->getWorldTransform();
|
||||
removeObject(handle);
|
||||
|
||||
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()
|
||||
|
@ -398,10 +398,16 @@ namespace Physic
|
||||
if (it != RigidBodyMap.end() )
|
||||
{
|
||||
RigidBody* body = it->second;
|
||||
btScaledBvhTriangleMeshShape* scaled = dynamic_cast<btScaledBvhTriangleMeshShape*> (body->getCollisionShape());
|
||||
|
||||
if(body != NULL)
|
||||
{
|
||||
delete body;
|
||||
}
|
||||
if(scaled != NULL)
|
||||
{
|
||||
delete scaled;
|
||||
}
|
||||
RigidBodyMap.erase(it);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user