forked from mirror/openmw-tes3mp
Fix the collision shape not updating when scaling an object via script
This commit is contained in:
parent
e5ce3f62b7
commit
b2746c8c01
2 changed files with 3 additions and 2 deletions
|
@ -1062,9 +1062,9 @@ namespace MWPhysics
|
||||||
void PhysicsSystem::updateScale(const MWWorld::Ptr &ptr)
|
void PhysicsSystem::updateScale(const MWWorld::Ptr &ptr)
|
||||||
{
|
{
|
||||||
ObjectMap::iterator found = mObjects.find(ptr);
|
ObjectMap::iterator found = mObjects.find(ptr);
|
||||||
float scale = ptr.getCellRef().getScale();
|
|
||||||
if (found != mObjects.end())
|
if (found != mObjects.end())
|
||||||
{
|
{
|
||||||
|
float scale = ptr.getCellRef().getScale();
|
||||||
found->second->setScale(scale);
|
found->second->setScale(scale);
|
||||||
mCollisionWorld->updateSingleAabb(found->second->getCollisionObject());
|
mCollisionWorld->updateSingleAabb(found->second->getCollisionObject());
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -73,6 +73,8 @@ namespace
|
||||||
osg::Vec3f scaleVec (scale, scale, scale);
|
osg::Vec3f scaleVec (scale, scale, scale);
|
||||||
ptr.getClass().adjustScale(ptr, scaleVec, true);
|
ptr.getClass().adjustScale(ptr, scaleVec, true);
|
||||||
rendering.scaleObject(ptr, scaleVec);
|
rendering.scaleObject(ptr, scaleVec);
|
||||||
|
|
||||||
|
physics.updateScale(ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +116,6 @@ namespace
|
||||||
{
|
{
|
||||||
addObject(ptr, mPhysics, mRendering);
|
addObject(ptr, mPhysics, mRendering);
|
||||||
updateObjectRotation(ptr, mPhysics, mRendering, false);
|
updateObjectRotation(ptr, mPhysics, mRendering, false);
|
||||||
updateObjectScale(ptr, mPhysics, mRendering);
|
|
||||||
ptr.getClass().adjustPosition (ptr, false);
|
ptr.getClass().adjustPosition (ptr, false);
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
|
|
Loading…
Reference in a new issue