Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Fixture

[17:7] extends: FxObj

Wraps jbox2d's Fixture (com.almasb.fxgl.physics.box2d.dynamics.Fixture), the per- shape attachment that lives on a Body. Carries the shape, friction, restitution, density, sensor flag, contact filter, the HitBox it backs, and optional user data.

Methods

  • Fixture ()

    Empty default constructor; populated by adopt.

  • adopt (object Ajo)

    Wraps an existing Fixture AussomJavaObject.

  • getBody ()

    Returns the owning Body AJO.

  • getShape ()

    Returns the Shape AJO.

  • getType ()

    Returns the ShapeType enum AJO.

  • getFilterData ()

    Returns the contact Filter wrapper.

  • setFilterData (object FilterObj)

    Updates the contact Filter from a Filter wrapper.

  • getDensity ()

  • setDensity (double V)

  • getFriction ()

  • setFriction (double V)

  • getRestitution ()

  • setRestitution (double V)

  • isSensor ()

  • setSensor (bool V)

  • getHitBox ()

    Returns the backing HitBox wrapper.

  • setHitBox (object HitBoxObj)

  • getUserData ()

  • setUserData (Data)

  • refilter ()

    Forces a contact filter refresh.

  • containsPoint (object PointVec)

    Returns true when the world-point sits inside this fixture's shape.

  • getProxyCount ()

    Returns the count of broad-phase proxies on this fixture (one per child shape for ChainShape; otherwise 1).

  • getProxyId (int ChildIndex)

    Returns the broad-phase proxy id at the given child shape index.

  • getMassData (object MassDataAjo)

    Fills MassDataAjo with the fixture's mass / center / inertia derived from its shape and density. The MassData AJO is populated in place.

  • getAABB (int ChildIndex)

    Returns the world-space AABB AJO for the given child shape index. Use 0 for non-chain shapes.

  • raycast (object OutputAjo, object InputAjo, int ChildIndex)

    Runs a raycast against this fixture, writing into Output.

    • @p OutputAjo is a RayCastOutput AJO to populate.
    • @p InputAjo is a RayCastInput AJO with the ray parameters.
    • @p ChildIndex is the child shape index (0 for non-chain).
    • @r true on hit, false otherwise.
  • computeDistance (object PointVec, int ChildIndex, object NormalOutVec)

    Returns the closest world-space distance from PointVec to this fixture for the given child index; writes the closest point on the fixture into NormalOutVec.