mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01: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()) {
|
||||
return;
|
||||
}
|
||||
if (!_parentID.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasLocalAngularVelocity()) {
|
||||
glm::vec3 localAngularVelocity = getLocalAngularVelocity();
|
||||
|
|
|
@ -422,8 +422,18 @@ void SpatiallyNestable::setVelocity(const glm::vec3& velocity, bool& success) {
|
|||
glm::vec3 parentVelocity = getParentVelocity(success);
|
||||
Transform parentTransform = getParentTransform(success);
|
||||
_velocityLock.withWriteLock([&] {
|
||||
// TODO: take parent angularVelocity into account.
|
||||
_velocity = glm::inverse(parentTransform.getRotation()) * (velocity - parentVelocity);
|
||||
// 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.
|
||||
_velocity = glm::inverse(parentTransform.getRotation()) * (velocity - parentVelocity);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue