webots icon indicating copy to clipboard operation
webots copied to clipboard

IndexedFaceSet matrix of inertia calculation (won't fix ?)

Open ShuffleWire opened this issue 3 years ago • 0 comments

Describe the Bug Using a solid with a boundingBox reprensented using a IndexedFaceSet, I give wrong result on the Inertia matrix.

I've setup a world with two "identical" world, the only difference is that the first is an IndexedFaceSet with 8 vertex and 12 triangles. The second use a regular Box shape.

I do understand that using IndexedFaceSet is a source a trouble anyway, and that should be enough to discourage user to use it as a bounding object, either for collision of for inertia matrix calculation.

World
#VRML_SIM R2022a utf8
WorldInfo {
  lineScale 10
}
Viewpoint {
  orientation -0.2143851446368171 0.5292491398702579 0.8209350508448542 0.6627621381687419
  position -5.715878494515186 -4.085058281951985 2.6505140233924966
}
TexturedBackground {
}
TexturedBackgroundLight {
}
Solid {
  children [
    DEF t Transform {
      translation -0.5 -0.5 -0.5
      children [
        Shape {
          geometry IndexedFaceSet {
            coord Coordinate {
              point [
                0 0 0
                0 0 1
                0 1 0
                0 1 1
                1 0 1
                1 0 0
                1 1 0
                1 1 1
              ]
            }
            coordIndex [
              0, 1, 2, -1, 0, 2, 6, -1, 0, 4, 1, -1, 0, 5, 4, -1, 0, 6, 5, -1, 1, 3, 2, -1, 1, 4, 7, -1, 1, 7, 3, -1, 2, 3, 7, -1, 2, 7, 6, -1, 4, 5, 6, -1, 4, 6, 7, -1
            ]
          }
        }
      ]
    }
  ]
  name "solid_indexed_face_set"
  boundingObject USE t
  physics Physics {
    density -1
    mass 1
  }
}
Solid {
  children [
    DEF box Shape {
      geometry Box {
        size 1 1 1
      }
    }
  ]
  name "solid_shape"
  boundingObject USE box
  physics Physics {
    density -1
    mass 1
  }
}

Steps to Reproduce

  1. Open the world, there are 2 identical cube, centered on the origin, with all edge of lenght 1. As stated in https://www.wolframalpha.com/input/?i=moment+of+inertia+cube, the inertia matrix should be [1/6, 1/6, 1/6, 0, 0, 0]
  2. Click on the Solid "solid_shape", open the mass property and see that the Inertia matrix is all right
  3. Click on the Solid "solid_indexed_face_set", open the mass property and see that the Inertia matrix is [2/3, 2/3, 2/3, -1/4, -1/4, -1/4], which is not correct

Expected behavior The inertia matrix should be the same whatever the way to represent the bounding object

System

  • Operating System: Debian 11
  • Webots 2022a

ShuffleWire avatar Jul 20 '22 15:07 ShuffleWire