Skip to content

Mismatch between AABB and mesh when mesh and skeleton don't have the same transform #74656

@SlugFiller

Description

@SlugFiller

Godot version

Master (9b9bb41)

System information

Irrelevant

Issue description

Somewhat of a sequel to #71953. Sorry in advance for doing this report half-energy. I'm not sure if it counts as a bug, or is simply "You're not supposed to do that", i.e. undefined behavior.

Basically, if a mesh and a skeleton have mismatching transforms, in rendering, the mesh seems to attach to the skeleton based on the global position. For instance, if a skeleton's bone has rotation, and the mesh is moved in the direction that the bone's rest pose points at, the skeleton-transformed mesh would move in the direction that the bone's current pose points at. Basically, as if each of the mesh's vertices was moved.

Meanwhile, the AABB calculation seems to assume that the mesh and skeleton have the same transformation. That is, it attaches to the skeleton based on the positions of the vertices within the mesh, and not based on the global positions.

I've confirmed this in 2D, but it's likely present in 3D as well, since they use common code. At least for AABB.

Steps to reproduce

  1. Have a mesh (MeshInstance2D, MeshInstance3D, Polygon2D) with a skeleton (Skeleton2D, Skeleton3D) attached.
  2. Move the skeleton to a non-rest pose
  3. Move the the mesh's origin to being away from the skeleton.
  4. Do some action that relies on AABB. e.g occlusion culling, canvas group, etc.

Minimal reproduction project

Left as an exercise to the reader. I'm not even sure if this is unintended behavior, since skeleton and mesh with different transforms doesn't sound like something a user is normally supposed to do.

For the 2D case, it's possible to just take the project from #71953 and use the move tool to move the polygon.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions