mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-17 01:10:10 +00:00
Actor collision object placement fix
This commit is contained in:
parent
65f0195c71
commit
2bc95df265
@ -87,7 +87,7 @@ void Actor::updatePosition()
|
||||
osg::Vec3f position = mPtr.getRefData().getPosition().asVec3();
|
||||
|
||||
btTransform tr = mCollisionObject->getWorldTransform();
|
||||
osg::Vec3f scaledTranslation = osg::componentMultiply(mMeshTranslation, mScale);
|
||||
osg::Vec3f scaledTranslation = mRotation * osg::componentMultiply(mMeshTranslation, mScale);
|
||||
osg::Vec3f newPosition = scaledTranslation + position;
|
||||
|
||||
tr.setOrigin(toBullet(newPosition));
|
||||
@ -97,8 +97,11 @@ void Actor::updatePosition()
|
||||
void Actor::updateRotation ()
|
||||
{
|
||||
btTransform tr = mCollisionObject->getWorldTransform();
|
||||
tr.setRotation(toBullet(mPtr.getRefData().getBaseNode()->getAttitude()));
|
||||
mRotation = mPtr.getRefData().getBaseNode()->getAttitude();
|
||||
tr.setRotation(toBullet(mRotation));
|
||||
mCollisionObject->setWorldTransform(tr);
|
||||
|
||||
updatePosition();
|
||||
}
|
||||
|
||||
void Actor::updateScale()
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "../mwworld/ptr.hpp"
|
||||
|
||||
#include <osg/Vec3f>
|
||||
#include <osg/Quat>
|
||||
#include <osg/ref_ptr>
|
||||
|
||||
class btDynamicsWorld;
|
||||
@ -109,6 +110,7 @@ namespace MWPhysics
|
||||
|
||||
osg::Vec3f mMeshTranslation;
|
||||
osg::Vec3f mHalfExtents;
|
||||
osg::Quat mRotation;
|
||||
|
||||
osg::Vec3f mScale;
|
||||
osg::Vec3f mPosition;
|
||||
|
Loading…
Reference in New Issue
Block a user