mirror of
https://github.com/overte-org/overte.git
synced 2025-08-12 22:44:58 +02:00
if spring is linked to another entity which we can't find, disable the spring
This commit is contained in:
parent
c9dfebb713
commit
dabec586ec
1 changed files with 12 additions and 5 deletions
|
@ -82,17 +82,24 @@ bool ObjectActionSpring::getTarget(float deltaTimeStep, glm::quat& rotation, glm
|
|||
float& linearTimeScale, float& angularTimeScale) {
|
||||
SpatiallyNestablePointer other = getOther();
|
||||
withReadLock([&]{
|
||||
if (other) {
|
||||
rotation = _desiredRotationalTarget * other->getRotation();
|
||||
position = _desiredPositionalTarget + other->getPosition();
|
||||
linearTimeScale = _linearTimeScale;
|
||||
angularTimeScale = _angularTimeScale;
|
||||
|
||||
if (_otherID != QUuid()) {
|
||||
if (other) {
|
||||
rotation = _desiredRotationalTarget * other->getRotation();
|
||||
position = _desiredPositionalTarget + other->getPosition();
|
||||
} else {
|
||||
// we should have an "other" but can't find it, so disable the spring.
|
||||
linearTimeScale = FLT_MAX;
|
||||
angularTimeScale = FLT_MAX;
|
||||
}
|
||||
} else {
|
||||
rotation = _desiredRotationalTarget;
|
||||
position = _desiredPositionalTarget;
|
||||
}
|
||||
linearVelocity = glm::vec3();
|
||||
angularVelocity = glm::vec3();
|
||||
linearTimeScale = _linearTimeScale;
|
||||
angularTimeScale = _angularTimeScale;
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue