Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question Cylinder Aabb surface Area and Height seems off

Discussion in 'Entity Component System' started by NT_Ninetails, Oct 1, 2020.

  1. NT_Ninetails

    NT_Ninetails

    Joined:
    Jan 21, 2018
    Posts:
    191
    I created a Cylinder Collider using the CylinderGeometry from PhysicsShapeAuthoring with:
    height = 0.5
    radius = 0.25
    orientation (90,0,0)
    so the cylinder is sitting upright.

    upload_2020-10-1_9-38-47.png

    I calculate the surface are using the radius and height and got 1.7units instead of 2.5units. (In terms of my values) I also noticed that the extents.y of the Aabb is double the height but since the height is technically the extents on the y axis, so shouldn't the extents.y just be the height?

    tmp, in the debug output view, is the default Cylinder.sharemesh bounds.
    mesh, in the debug output view, is the modified mesh used to replicate the PhysicsShapeAuthoring gizmo mesh

    Also in order for the final mesh gizmo to match the PhysicsShapeAuthoring gizmo i have to further reduce the height. are the units in the PhysicsShapeArthoring different from the default GameObject units?
     
  2. iamarugin

    iamarugin

    Joined:
    Dec 17, 2014
    Posts:
    861
    This is the default behaviour for rotated AABB. Because AABB doesn't know anything about your mesh. It could be cube. And for cube it is valid values.
     
  3. NT_Ninetails

    NT_Ninetails

    Joined:
    Jan 21, 2018
    Posts:
    191
    thank you.