moveKinematic method

  1. @override
void moveKinematic(
  1. int body,
  2. Vector3 position,
  3. Quaternion rotation,
  4. double dt,
)
override

Moves a kinematic body so it arrives at position and rotation after dt seconds, giving it the velocity that takes.

Implementation

@override
void moveKinematic(
  int body,
  Vector3 position,
  Quaternion rotation,
  double dt,
) {
  final b = _moving(body);
  if (b == null || b.type != BodyType3D.kinematic || dt <= 0) return;
  b._kinematicTarget = Vector3.copy(position);
  b.linearVelocity
    ..setFrom(position)
    ..sub(b.position)
    ..scale(1 / dt);
  b.rotation.setFrom(_unitOf(rotation));
  b._turn();
  _wake(b);
}