calculateInertia static method

Vec3 calculateInertia(
  1. Vec3 halfExtents,
  2. num mass,
  3. Vec3 target
)

Implementation

static Vec3 calculateInertia(Vec3 halfExtents,num mass, Vec3 target){
  final Vec3 e = halfExtents;
  target.x = 1.0 / 12.0 * mass * (2 * e.y * 2 * e.y + 2 * e.z * 2 * e.z);
  target.y = 1.0 / 12.0 * mass * (2 * e.x * 2 * e.x + 2 * e.z * 2 * e.z);
  target.z = 1.0 / 12.0 * mass * (2 * e.y * 2 * e.y + 2 * e.x * 2 * e.x);
  return target;
}