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

A circle shape. More...

#include <Collider2D.h>

Inherits Collider2D.

Public Member Functions

float getRadius () const
 Get the circle's radius.
Vec2 getOffset () override
 Get this circle's position offset.
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 getCenter ()
 Get this shape's center position.
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 CircleCollider2D * create (float radius, const PhysicsMaterial2D &material=PHYSICS_MATERIAL_2D_DEFAULT, const Vec2 &offset=Vec2(0.0f, 0.0f))
 Creates a CircleCollider2D 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

A circle shape.

Member Function Documentation

◆ create()

CircleCollider2D * create ( float radius,
const PhysicsMaterial2D & material = PHYSICS_MATERIAL_2D_DEFAULT,
const Vec2 & offset = Vec2(0.0f, 0.0f) )
static

Creates a CircleCollider2D with specified value.

Parameters
radiusA float number, it is the circle's radius.
materialA PhysicsMaterial2D object, the default value is PHYSICS_MATERIAL_2D_DEFAULT.
offsetA Vec2 object, it is the offset from the body's center of gravity in body local coordinates.
Returns
An autoreleased CircleCollider2D object pointer.

◆ getRadius()

float getRadius ( ) const

Get the circle's radius.

Returns
A float number.

◆ getOffset()

Vec2 getOffset ( )
overridevirtual

Get this circle's position offset.

Returns
A Vec2 object.

Reimplemented from Collider2D.


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