constrain method
Called after update is complete, if the constraint has been added to a Node. Override this method to modify the node's property according to the constraint.
Implementation
@override
void constrain(Node node, double dt) {
if (_lastPosition == null) return;
if (_lastPosition == node.position) return;
// Get the target angle
Offset offset = node.position - _lastPosition!;
double target =
degrees(GameMath.atan2(offset.dy, offset.dx)) + baseRotation;
node.rotation = _dampenRotation(node.rotation, target, dampening);
}