mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 22:22:54 +02:00
Merge pull request #7631 from sethalves/parent-equipping-and-platform-hack
treat children of avatars and children of entities differently until velocity handling is fixed
This commit is contained in:
commit
cc418c615f
2 changed files with 12 additions and 5 deletions
|
@ -888,9 +888,6 @@ void EntityItem::simulateKinematicMotion(float timeElapsed, bool setFlags) {
|
||||||
if (hasActions()) {
|
if (hasActions()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!_parentID.isNull()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasLocalAngularVelocity()) {
|
if (hasLocalAngularVelocity()) {
|
||||||
glm::vec3 localAngularVelocity = getLocalAngularVelocity();
|
glm::vec3 localAngularVelocity = getLocalAngularVelocity();
|
||||||
|
|
|
@ -422,8 +422,18 @@ void SpatiallyNestable::setVelocity(const glm::vec3& velocity, bool& success) {
|
||||||
glm::vec3 parentVelocity = getParentVelocity(success);
|
glm::vec3 parentVelocity = getParentVelocity(success);
|
||||||
Transform parentTransform = getParentTransform(success);
|
Transform parentTransform = getParentTransform(success);
|
||||||
_velocityLock.withWriteLock([&] {
|
_velocityLock.withWriteLock([&] {
|
||||||
|
// HACK: until we are treating _velocity the same way we treat _position (meaning,
|
||||||
|
// _velocity is a vs parent value and any request for a world-frame velocity must
|
||||||
|
// be computed), do this to avoid equipped (parenting-grabbed) things from drifting.
|
||||||
|
// turning a zero velocity into a non-zero _velocity (because the avatar is moving)
|
||||||
|
// causes EntityItem::simulateKinematicMotion to have an effect on the equipped entity,
|
||||||
|
// which causes it to drift from the hand.
|
||||||
|
if (hasAncestorOfType(NestableType::Avatar)) {
|
||||||
|
_velocity = velocity;
|
||||||
|
} else {
|
||||||
// TODO: take parent angularVelocity into account.
|
// TODO: take parent angularVelocity into account.
|
||||||
_velocity = glm::inverse(parentTransform.getRotation()) * (velocity - parentVelocity);
|
_velocity = glm::inverse(parentTransform.getRotation()) * (velocity - parentVelocity);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue