addConstantCentralForce(_:)

    Adds a constant directional force without affecting rotation that keeps being applied over time until cleared with constant_force = Vector2(0, 0).

    RigidBody2D.swift:1516
    final func addConstantCentralForce(_ force: Vector2)

    This is equivalent to using addConstantForce(_:position:) at the body’s center of mass.

    Other members in extension

    Types

    Type members

    Instance members

    Show implementation details (1)

    Hide implementation details

    • func _integrateForces(state: PhysicsDirectBodyState2D?)

      Allows you to read and safely modify the simulation state for the object. Use this instead of _physicsProcess(delta:) if you need to directly change the body’s position or other physics properties. By default, it works in addition to the usual physics behavior, but customIntegrator allows you to disable the default behavior and write custom force integration for a body.