|
|
@ -117,27 +117,15 @@ int Actor::getCollisionMask() const
|
|
|
|
void Actor::updatePosition()
|
|
|
|
void Actor::updatePosition()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::scoped_lock lock(mPositionMutex);
|
|
|
|
std::scoped_lock lock(mPositionMutex);
|
|
|
|
updateWorldPosition();
|
|
|
|
const auto worldPosition = mPtr.getRefData().getPosition().asVec3();
|
|
|
|
mPreviousPosition = mWorldPosition;
|
|
|
|
mPreviousPosition = worldPosition;
|
|
|
|
mPosition = mWorldPosition;
|
|
|
|
mPosition = worldPosition;
|
|
|
|
mSimulationPosition = mWorldPosition;
|
|
|
|
mSimulationPosition = worldPosition;
|
|
|
|
mPositionOffset = osg::Vec3f();
|
|
|
|
mPositionOffset = osg::Vec3f();
|
|
|
|
mStandingOnPtr = nullptr;
|
|
|
|
mStandingOnPtr = nullptr;
|
|
|
|
mSkipCollisions = true;
|
|
|
|
mSkipCollisions = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Actor::updateWorldPosition()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (mWorldPosition != mPtr.getRefData().getPosition().asVec3())
|
|
|
|
|
|
|
|
mWorldPositionChanged = true;
|
|
|
|
|
|
|
|
mWorldPosition = mPtr.getRefData().getPosition().asVec3();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
osg::Vec3f Actor::getWorldPosition() const
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return mWorldPosition;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Actor::setSimulationPosition(const osg::Vec3f& position)
|
|
|
|
void Actor::setSimulationPosition(const osg::Vec3f& position)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mSimulationPosition = position;
|
|
|
|
mSimulationPosition = position;
|
|
|
@ -174,7 +162,6 @@ osg::Vec3f Actor::getCollisionObjectPosition() const
|
|
|
|
bool Actor::setPosition(const osg::Vec3f& position)
|
|
|
|
bool Actor::setPosition(const osg::Vec3f& position)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::scoped_lock lock(mPositionMutex);
|
|
|
|
std::scoped_lock lock(mPositionMutex);
|
|
|
|
updateWorldPosition();
|
|
|
|
|
|
|
|
applyOffsetChange();
|
|
|
|
applyOffsetChange();
|
|
|
|
bool hasChanged = mPosition != position || mWorldPositionChanged;
|
|
|
|
bool hasChanged = mPosition != position || mWorldPositionChanged;
|
|
|
|
mPreviousPosition = mPosition;
|
|
|
|
mPreviousPosition = mPosition;
|
|
|
|