PhysicsSolving

public protocol PhysicsSolving
  • The velocity value to use in physics calculations.

    Declaration

    Swift

    var velocity: Double
  • The friction value to be applied in physics calculations.

    Declaration

    Swift

    var friction: Double
  • This method updates 1D positions using physics calculations.

    Declaration

    Swift

    func solve(forPositions positions: [Double], timestamp: TimeInterval) -> [Double]

    Parameters

    positions

    The current positions of the physics object being modeled.

    currentTime

    The current timestamp.

    Return Value

    An array of updated positions in the same order as the array passed in.

  • This method should reset the physics system to its initial velocity and clear the timestamp used to calculate the current step.

    Declaration

    Swift

    func reset()
  • This method should pause the physics system, preventing any new calculations.

    Declaration

    Swift

    func pause()
  • This method should resume the physics system.

    Declaration

    Swift

    func resume()
  • This method should reverse the direction of the velocity.

    Declaration

    Swift

    func reverseDirection()