createBody method
Makes a body of shape; 0 when it cannot be made (a shape that is
not Shape3D.isValid, a mesh or a height field on a body that is not
static, a layer outside 0–15, a full world).
Implementation
@override
int createBody(Shape3D shape, BodySettings3D settings) {
if (_disposed ||
settings.layer < 0 ||
settings.layer > 15 ||
!shape.isValid ||
bodies.length >= _maxBodies) {
return 0;
}
if (_mustBeStatic(shape) && settings.type != BodyType3D.static) return 0;
final body = FakeBody3D._(_next++, shape, settings);
bodies[body.handle] = body;
if (body.awake) _activated(body);
return body.handle;
}