createBody method
int
createBody({
- required PoseTarget target,
- required BodyType type,
- double? additionalMass,
override
Creates a body at target's current pose and returns its handle.
Dynamic bodies write their simulated pose back to target during
interpolatePoses.
Implementation
@override
int createBody({
required PoseTarget target,
required BodyType type,
double? additionalMass,
}) {
if (type == BodyType.dynamic_) {
throw UnsupportedError(
'BasicSimulation does not simulate dynamics; use a backend with a '
'solver for BodyType.dynamic_.',
);
}
final handle = _nextHandle++;
_bodies[handle] = _BasicBody(target, type);
return handle;
}