linearVelocity property

Vector2 linearVelocity

Get the linear velocity of the center of mass. Do not modify, instead use {@link #setLinearVelocity(Vec2)}.

@return the linear velocity of the center of mass.

Implementation

Vector2 get linearVelocity => _linearVelocity;
void linearVelocity= (Vector2 v)

Set the linear velocity of the center of mass.

@param v the new linear velocity of the center of mass.

Implementation

void set linearVelocity(Vector2 v) {
  if (_bodyType == BodyType.STATIC) {
    return;
  }

  if (v.dot(v) > 0.0) {
    setAwake(true);
  }

  _linearVelocity.setFrom(v);
}