Axmol 3.0.0-89d6d9a
Loading...
Searching...
No Matches
EdgePolygonCollider2D Class Reference

An edge polygon shape. More...

#include <Collider2D.h>

Inherits Collider2D.

Public Member Functions

Vec2 getCenter () override
 Get this polygon's center position.
void getPoints (Vec2 *outPoints) const
 Get this polygon's points array.
int getPointsCount () const
 Get this polygon's points array count.
Public Member Functions inherited from Collider2D
Rigidbody2D * getAttachedBody () const
 Get the body that this shape attaches.
Type getType () const
 Return this shape's type.
void setTag (unsigned int tag)
 Set this shape's tag.
unsigned int getTag () const
 Get this shape's tag.
float getDensity () const
 Get this shape's density.
void setDensity (float density, bool apply=true)
 Set this shape's density.
float getRestitution () const
 Get this shape's restitution.
void setRestitution (float restitution, bool apply=true)
 Set this shape's restitution.
float getFriction () const
 Get this shape's friction.
void setFriction (float friction, bool apply=true)
 Set this shape's friction.
const PhysicsMaterial2D & getMaterial () const
 Get this shape's PhysicsMaterial2D object.
void setMaterial (const PhysicsMaterial2D &material)
 Set this shape's material.
bool isSensor () const
 Check whether this collider is configured as a sensor.
void setSensor (bool sensor)
 Enable or disable sensor behavior for this collider.
bool isEventEnabled (ContactEventBits events) const
 Check whether one or more event types are enabled for this collider.
void setEventEnabled (ContactEventBits events, bool enabled)
 Enable or disable one or more event types for this collider.
void refreshEventFlags ()
 Re-applies the effective event mask to all attached native shapes.
virtual Vec2 getOffset ()
 Get this shape's position offset.
bool containsPoint (const Vec2 &point) const
 Test point is inside this shape or not.
void setCategoryBits (uint64_t categoryBits)
 Set a mask that defines which categories this physics body belongs to.
uint64_t getCategoryBits () const
 Get a mask that defines which categories this physics body belongs to.
void setMaskBits (uint64_t maskBits)
 A mask that defines which categories of physics bodies can collide with this physics body.
uint64_t getMaskBits () const
 Get a mask that defines which categories of physics bodies can collide with this physics body.
void setGroup (int groupIndex)
 Set the group of body.
int getGroup () const
 Get the group of body.
Public Member Functions inherited from Object
void retain ()
 Retains the ownership.
void release ()
 Releases the ownership immediately.
Object * autorelease ()
 Releases the ownership sometime soon automatically.
unsigned int getReferenceCount () const
 Returns the Object's current reference count.
uint64_t getObjectID () const noexcept
 Returns the process-local diagnostic identifier assigned at construction.
virtual ~Object ()
 Destructor.

Static Public Member Functions

static EdgePolygonCollider2D * create (std::span< const Vec2 > points, const PhysicsMaterial2D &material=PHYSICS_MATERIAL_2D_DEFAULT)
 Creates a EdgePolygonCollider2D with specified value.
Static Public Member Functions inherited from Collider2D
static void recenterPoints (Vec2 *points, int count, const Vec2 &center=Vec2::zero)
 Move the points to the center.
static Vec2 getPolygonCenter (std::span< const Vec2 > points)
 Get center of the polygon points.

Additional Inherited Members

Public Types inherited from Collider2D
enum class  Type { }

Detailed Description

An edge polygon shape.

Member Function Documentation

◆ create()

EdgePolygonCollider2D * create ( std::span< const Vec2 > points,
const PhysicsMaterial2D & material = PHYSICS_MATERIAL_2D_DEFAULT )
static

Creates a EdgePolygonCollider2D with specified value.

Parameters
pointsA Vec2 object pointer, it contains an array of points.
materialA PhysicsMaterial2D object, the default value is PHYSICS_MATERIAL_2D_DEFAULT.
Returns
An autoreleased EdgePolygonCollider2D object pointer.

◆ getCenter()

Vec2 getCenter ( )
overridevirtual

Get this polygon's center position.

Returns
A Vec2 object.

Reimplemented from Collider2D.

◆ getPoints()

void getPoints ( Vec2 * outPoints) const

Get this polygon's points array.

Parameters
outPointsA Vec2 array pointer.

◆ getPointsCount()

int getPointsCount ( ) const

Get this polygon's points array count.

Returns
An integer number.

The documentation for this class was generated from the following file:
  • Collider2D.h