mojira.dev
MCPE-114253

Squid rendering is offset in the -Y direction

Squid in water are rendered about .5 blocks lower than their collision box. This is especially noticeable in 1-block high water, where squid appear half in the ground.

Steps to reproduce

  1. Load the attached test world:

[media]
  1. Press the button on the command block to spawn a squid in the box.

  2. Press the button on the dispenser to toggle water in the space where the squid is located.

  3. Attempt to hit the lower part of the squid that hangs below the carpet, then attempt to punch the glass behind the squid by swinging above it.

Expected result

The squid's rendering is not affected by placing and removing water. When you punch the squid where it appears, you hit the squid. When you punch the air above the squid, you don't hit the squid.

Actual result

When you place the water, the squid's rendering shifts by about -0.5 Y. When you then punch the part of the squid that appears below the carpet, you do not hit it. When you punch the space that appears empty above the squid, you hit it. See the attached video:

[media]

Linked issues

Attachments

Comments 4

The bug here is in the following line of the animations\squid.animation.json

"body": { "position": [ 0.0, "query.is_in_water ? 0.0 : (query.is_baby ? 3.2 : 6.4)", 0.0 ] }

There are at least 2, and arguably 3 errors in the above line.

  1. There is no reason to use query.is_in_water to change the squid's Y-rendering position in water. There is especially no reason to drop its rendered center to the bottom of its collision box, which what the 0.0 there does.

  2. There is no reason to use query.is_baby to give the baby squid animation different bones. The baby's bones already scale with its collision box before the offset in this line is applied.

  3. The value of 6.4 for the adult squid's movement animation Y-center appears to be based on the Java squid collision box of 0.8 rather than the Bedrock squid collision box of 0.95 defined in the vanilla behavior pack entity\squid.json. ( 6.4 = 1/2 * 0.8 Java collision_box height * 16 Y texture size ) The value of 6.4 does not center the squid with its collision box, nor does it align the bottom of the squid with the bottom of the block space at any point in its rotation--it floats just above the bottom of the block when flat and its corners clip through the bottom of the block when diagonal. If we use instead 1/2 * 0.95 Bedrock collision_box height * 16 Y texture size = 7.6 for the movement animation Y center, then the squid actually appears more centered in the block and its corners just touch the bottom of the block when diagonal.

If I am correct only about points (1) and (2), then the bugged line should be

"body": { "position": [ 0.0, 6.4, 0.0 ] }

If I am also correct about point (3), then the bugged line should be

"body": { "position": [ 0.0, 7.6, 0.0 ] }

I made a resource pack using the latter line for evaluation:

[media]

The new glowsquid has the same bug:

[media]

The fix in 1.16.220.50 beta makes the squid animation the same on land and water, but both are still too low.

[media]

[media]

Steps to reproduce

  1. Spawn an adult squid in a 1-block space where you can see how it aligns with the block below, and watch it rotate.

  2. Next to that, spawn an baby squid in a 1-block space where you can see how it aligns with the block below, and watch it rotate.

Expected result

The baby squid would appear to sit at the same level as the adult squid, and neither would clip into the block below.

Actual result

The baby squid appears to sit a about a pixel lower than the adult squid and always clips into the block below. The corners of the adult squid's head clip into the block below when it rotates. (See pictures above.)

Test world

[media]

is set up for easy viewing of the adult and baby squid alignment and has command blocks set to align the player's eye-level with the middle and bottom of the squid boxes. It contains resource packs that implement the 1.16.220.50 beta fix and the second fix I suggest below (Y offset 7.6). These should be able to be toggled for comparison.

Fix

Use this to fix both the baby and the adult:

"body": { "position": [ 0.0, 7.6, 0.0 ] }
[media]

[media]


For explanation and sample pack see my previous analysis comment.

Alternate fix

Change the squid collision box from 0.95 to 0.80 to match Java, and use this for both baby and adult:

"body": { "position": [ 0.0, 6.4, 0.0 ] }

Affects 1.17.40.20

GoldenHelmet

(Unassigned)

489551

Confirmed

Windows

1.17.11 Hotfix, 1.16.220.51 Beta, 1.16.210.59 Beta, 1.16.210.54 Beta, 1.16.201 Hotfix, 1.16.210, 1.17.0, 1.20.0

1.21.100.20 Preview, 1.16.220.50 Beta, 1.21.100

Retrieved