-
Bug
-
Resolution: Unresolved
-
None
-
1.19.70.24/25 Preview, 1.19.70.22 Preview, 1.19.70.21 Preview, 1.18.10.26 Beta, 1.17.0.54 Beta, 1.17.0.50 Beta, 1.16.220, 1.16.230.50 Beta, 1.16.210, 1.16.221 Hotfix, 1.18.2 Hotfix, 1.19.60, 1.19.63, 1.20.0.24 Preview, 1.19.81 Hotfix
-
None
-
Confirmed
-
Multiple
-
496397
Steps to Reproduce:
- Swim towards a corner, with a block above you.
- Stop moving.
Observed Results:
The player's arms and legs keep moving.
Expected Results:
The swimming animation pauses, and continues when you start moving again.
Screenshots/Videos attached: No
Notes: This can be fixed by changing the animation from this...
"animation.player.swim" : { "animation_length" : 1.3, "loop" : true, "override_previous_animation" : true, "bones" : { "leftarm" : { "rotation" : { "0" : [ 0.0, 180.0, 180.0 ], "0.7" : [ 0.0, 180.0, 287.2 ], "1.1" : [ 90.0, 180.0, 180.0 ], "1.3" : [ 0.0, 180.0, 180.0 ] } }, "rightarm" : { "rotation" : { "0" : [ 0.0, 180.0, -180.0 ], "0.7" : [ 0.0, 180.0, -287.2 ], "1.1" : [ 90.0, 180.0, -180.0 ], "1.3" : [ 0.0, 180.0, -180.0 ] } }, "root" : { "position" : [ 0.0, "(math.sin(query.target_x_rotation) * 24.0 + 3.0) * variable.swim_amount", "(math.cos(query.target_x_rotation) * 24.0 + 9.0) * variable.swim_amount" ], "rotation" : [ "variable.swim_amount * (90 + query.target_x_rotation)", 0.0, 0.0 ] } } }, "animation.player.swim.legs" : { "loop" : true, "override_previous_animation" : true, "bones" : { "leftleg" : { "rotation" : [ "math.lerp(0.0, math.cos(query.life_time * 390.0 + 180.0) * 17.2, variable.swim_amount)", 0.0, 0.0 ] }, "rightleg" : { "rotation" : [ "math.lerp(0.0, math.cos(query.life_time * 390.0) * 17.2, variable.swim_amount)", 0.0, 0.0 ] } } }, "animation.player.swim.legs.single" : { "loop" : true, "override_previous_animation" : true, "bones" : { "leftleg" : { "rotation" : [ "math.lerp(0.0, math.cos(query.life_time * 390.0) * 17.2, variable.swim_amount)", 0.0, 0.0 ] }, "rightleg" : { "rotation" : [ "math.lerp(0.0, math.cos(query.life_time * 390.0) * 17.2, variable.swim_amount)", 0.0, 0.0 ] } } }
to this:
"animation.player.swim" : { "loop" : true, "bones" : { "leftarm" : { "rotation" : [ "math.lerp(0.0, (math.mod(query.modified_distance_moved, 26.0) < 22.0 ? 90.0 * math.clamp(math.mod(query.modified_distance_moved, 26.0) - 14.0, 0.0, 8.0) / 8.0 : 90.0 - 90.0 * (math.mod(query.modified_distance_moved, 26) - 22.0) / 4.0) - this, variable.swim_amount)", "math.lerprotate(0.0, 180.0 - this, variable.swim_amount)", "math.lerprotate(0.0, (math.mod(query.modified_distance_moved, 26.0) < 14.0 ? 180.0 + 107.18873 * math.mod(query.modified_distance_moved, 26.0) / 14.0 : 287.18873 - 107.18873 * math.clamp(math.mod(query.modified_distance_moved, 26) - 14.0, 0.0, 8.0) / 8.0) - this, variable.swim_amount)" ] }, "rightarm" : { "rotation" : [ "math.lerp(0.0, (math.mod(query.modified_distance_moved, 26.0) < 22.0 ? 90.0 * math.clamp(math.mod(query.modified_distance_moved, 26.0) - 14.0, 0.0, 8.0) / 8.0 : 90.0 - 90.0 * (math.mod(query.modified_distance_moved, 26) - 22.0) / 4.0) - this, variable.swim_amount)", "math.lerp(0.0, 180.0 - this, variable.swim_amount)", "math.lerp(0.0, (math.mod(query.modified_distance_moved, 26.0) < 14.0 ? 180.0 - 107.18873 * math.mod(query.modified_distance_moved, 26.0) / 14.0 : 72.81127 + 107.18873 * math.clamp(math.mod(query.modified_distance_moved, 26) - 14.0, 0.0, 8.0) / 8.0) - this, variable.swim_amount)" ] }, "root" : { "position" : [ 0.0, "math.sin(math.lerp(-90.0, query.target_x_rotation, variable.swim_amount)) * 17.0 + 17.0 - 12.0 * variable.swim_amount", "math.cos(math.lerp(-90.0, query.target_x_rotation * query.is_in_water, variable.swim_amount)) * 17.0" ], "rotation" : [ "variable.swim_amount * (90.0 + query.target_x_rotation)", 0.0, 0.0 ] } } }, "animation.player.swim.legs" : { "loop" : true, "bones" : { "leftleg" : { "rotation" : [ "math.lerp(0.0, math.cos(query.modified_distance_moved * 19.09859 + 180.0) * 17.18873 - this, variable.swim_amount)", 0.0, 0.0 ] }, "rightleg" : { "rotation" : [ "math.lerp(0.0, math.cos(query.modified_distance_moved * 19.09859) * 17.18873 - this, variable.swim_amount)", 0.0, 0.0 ] } } }, "animation.player.swim.legs.single" : { "loop" : true, "bones" : { "leftleg" : { "rotation" : [ "math.lerp(0.0, math.cos(query.modified_distance_moved * 19.09859) * 17.18873 - this, variable.swim_amount)", 0.0, 0.0 ] }, "rightleg" : { "rotation" : [ "math.lerp(0.0, math.cos(query.modified_distance_moved * 19.09859) * 17.18873 - this, variable.swim_amount)", 0.0, 0.0 ] } } }
This fix also addresses MCPE-122663, and adds a smooth transition to the swimming pose for the limbs, which can't be done with a custom anim_time_update and keyframes.
The math has been simplified as much as possible, using clamps instead of multiple conditions. It can be shortened further by replacing every instance of math.mod(query.modified_distance_moved, 26.0) with a variable.
- is duplicated by
-
MCPE-127718 Hands and legs keep moving when swimming in third-person and a block is in front of the player
- Resolved
- relates to
-
MCPE-122663 Player model isn't centered when swimming
- Reopened