mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 14:59:47 +02:00
Merge pull request #8268 from sethalves/fix-throwing-some-more
improve throwing release velocity
This commit is contained in:
commit
90c8abb4e9
1 changed files with 6 additions and 4 deletions
|
@ -207,8 +207,10 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) {
|
||||||
}
|
}
|
||||||
|
|
||||||
withWriteLock([&]{
|
withWriteLock([&]{
|
||||||
if (_previousSet) {
|
if (_previousSet &&
|
||||||
|
_positionalTarget != _previousPositionalTarget) { // don't average in a zero velocity if we get the same data
|
||||||
glm::vec3 oneFrameVelocity = (_positionalTarget - _previousPositionalTarget) / deltaTimeStep;
|
glm::vec3 oneFrameVelocity = (_positionalTarget - _previousPositionalTarget) / deltaTimeStep;
|
||||||
|
|
||||||
_measuredLinearVelocities[_measuredLinearVelocitiesIndex++] = oneFrameVelocity;
|
_measuredLinearVelocities[_measuredLinearVelocitiesIndex++] = oneFrameVelocity;
|
||||||
if (_measuredLinearVelocitiesIndex >= AvatarActionHold::velocitySmoothFrames) {
|
if (_measuredLinearVelocitiesIndex >= AvatarActionHold::velocitySmoothFrames) {
|
||||||
_measuredLinearVelocitiesIndex = 0;
|
_measuredLinearVelocitiesIndex = 0;
|
||||||
|
@ -228,9 +230,9 @@ void AvatarActionHold::doKinematicUpdate(float deltaTimeStep) {
|
||||||
// 3 -- ignore i of 0 1 2
|
// 3 -- ignore i of 0 1 2
|
||||||
// 4 -- ignore i of 1 2 3
|
// 4 -- ignore i of 1 2 3
|
||||||
// 5 -- ignore i of 2 3 4
|
// 5 -- ignore i of 2 3 4
|
||||||
if ((i + 1) % 6 == _measuredLinearVelocitiesIndex ||
|
if ((i + 1) % AvatarActionHold::velocitySmoothFrames == _measuredLinearVelocitiesIndex ||
|
||||||
(i + 2) % 6 == _measuredLinearVelocitiesIndex ||
|
(i + 2) % AvatarActionHold::velocitySmoothFrames == _measuredLinearVelocitiesIndex ||
|
||||||
(i + 3) % 6 == _measuredLinearVelocitiesIndex) {
|
(i + 3) % AvatarActionHold::velocitySmoothFrames == _measuredLinearVelocitiesIndex) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
measuredLinearVelocity += _measuredLinearVelocities[i];
|
measuredLinearVelocity += _measuredLinearVelocities[i];
|
||||||
|
|
Loading…
Reference in a new issue