Function createRectangle

  • Create a body with a rectangular shape

    Parameters

    • world: World

      The world in which to create the body

    • center: Vector2

      The center of the body

    • width: number

      The height of the rectangle shape to attach

    • height: number

      The width of the rectangle shape to attach

    • mass: number

      The mass to give the newly created body

    • friction: number

      The friction to apply during collisions with the new body

    • restitution: number

      The friction to apply during collisions with the new body

    • sensor: boolean = false
    • Optional data: any

    Returns Body

    The newly created body