addShape method

Body addShape(
  1. Shape shape, [
  2. Vector3? offset,
  3. Quaternion? orientation
])

Add a shape to the body with a local offset and orientation. @return The body object, for chainability.

Implementation

Body addShape(Shape shape,[Vector3? offset, Quaternion? orientation]){
  final off = Vector3.zero();
  final or = Quaternion(0,0,0,1);

  if (offset != null) {
    off.setFrom(offset);
  }
  if (orientation != null) {
    or.setFrom(orientation);
  }

  shapes.add(shape);
  shapeOffsets.add(off);
  shapeOrientations.add(or);
  updateMassProperties();
  updateBoundingRadius();

  aabbNeedsUpdate = true;
  shape.body = this;

  return this;
}