![]() |
Cornell Cocos
Cornell Extensions to Cocos2d
|
#include <CUWheelObstacle.h>
Public Member Functions | |
float | getRadius () const |
void | setRadius (float value) |
virtual void | createFixtures () override |
virtual void | releaseFixtures () override |
CC_CONSTRUCTOR_ACCESS | _geometry (nullptr) |
virtual bool | init () override |
virtual bool | init (const Vec2 &pos) override |
virtual bool | init (const Vec2 &pos, float radius) |
![]() | |
virtual b2BodyType | getBodyType () const override |
virtual void | setBodyType (b2BodyType value) override |
virtual Vec2 | getPosition () const override |
virtual void | setPosition (const Vec2 &value) override |
virtual void | setPosition (float x, float y) override |
virtual float | getX () const override |
virtual void | setX (float value) override |
virtual float | getY () const override |
virtual void | setY (float value) override |
virtual float | getAngle () const override |
virtual void | setAngle (float value) override |
virtual Vec2 | getLinearVelocity () const override |
virtual void | setLinearVelocity (const Vec2 &value) override |
virtual void | setLinearVelocity (float x, float y) override |
virtual float | getVX () const override |
virtual void | setVX (float value) override |
virtual float | getVY () const override |
virtual void | setVY (float value) override |
virtual float | getAngularVelocity () const override |
virtual void | setAngularVelocity (float value) override |
virtual bool | isActive () const override |
virtual void | setActive (bool value) override |
virtual bool | isAwake () const override |
virtual void | setAwake (bool value) override |
virtual bool | isSleepingAllowed () const override |
virtual void | setSleepingAllowed (bool value) override |
virtual bool | isBullet () const override |
virtual void | setBullet (bool value) override |
virtual bool | isFixedRotation () const override |
virtual void | setFixedRotation (bool value) override |
virtual float | getGravityScale () const override |
virtual void | setGravityScale (float value) override |
virtual float | getLinearDamping () const override |
virtual void | setLinearDamping (float value) override |
virtual float | getAngularDamping () const override |
virtual void | setAngularDamping (float value) override |
virtual void | setDensity (float value) override |
virtual void | setFriction (float value) override |
virtual void | setRestitution (float value) override |
virtual void | setSensor (bool value) override |
virtual void | setFilterData (b2Filter value) override |
virtual Vec2 | getCentroid () const override |
virtual void | setCentroid (const Vec2 &value) override |
virtual void | setCentroid (float x, float y) override |
virtual float | getInertia () const override |
virtual void | setInertia (float value) override |
virtual float | getMass () const override |
virtual void | setMass (float value) override |
virtual void | resetMass () override |
virtual b2Body * | getBody () const override |
virtual bool | activatePhysics (b2World &world) override |
virtual void | deactivatePhysics (b2World &world) override |
virtual void | update (float delta) override |
int | getPositionSnap () |
void | setPositionSnap (unsigned int snap) |
int | getAngleSnap () |
void | setAngleSnap (unsigned int snap) |
virtual void | positionSceneNode () override |
virtual void | positionDebugNode () override |
CC_CONSTRUCTOR_ACCESS | _body (nullptr) |
virtual | ~SimpleObstacle () |
![]() | |
void | setBodyState (const b2Body &body) |
float | getDensity () const |
float | getFriction () const |
float | getRestitution () const |
bool | isSensor () const |
b2Filter | getFilterData () const |
bool | isRemoved () const |
void | markRemoved (bool value) |
bool | isDirty () const |
void | markDirty (bool value) |
const Vec2 & | getDrawScale () const |
virtual void | setDrawScale (const Vec2 &value) |
virtual void | setDrawScale (float x, float y) |
Node * | getSceneNode () const |
void | setSceneNode (Node *node) |
WireNode * | getDebugNode () const |
void | setDebugNode (WireNode *node) |
string | getName () const |
void | setName (string value) |
string | toString () const |
virtual | ~Obstacle () |
Static Public Member Functions | |
static WheelObstacle * | create () |
static WheelObstacle * | create (const Vec2 &pos) |
static WheelObstacle * | create (const Vec2 &pos, float radius) |
Public Attributes | |
CC_CONSTRUCTOR_ACCESS | __pad0__: WheelObstacle(void) : SimpleObstacle() |
![]() | |
CC_CONSTRUCTOR_ACCESS | __pad0__: SimpleObstacle() : Obstacle() |
![]() | |
CC_CONSTRUCTOR_ACCESS | __pad0__: Obstacle(void) |
Protected Member Functions | |
virtual void | resetDebugNode () override |
![]() | |
virtual void | resetSceneNode () |
Protected Attributes | |
b2CircleShape | _shape |
b2Fixture * | _geometry |
![]() | |
b2Body * | _body |
int | _posSnap |
unsigned long | _posFact |
int | _angSnap |
unsigned long | _angFact |
![]() | |
b2BodyDef | _bodyinfo |
b2FixtureDef | _fixture |
b2MassData | _massdata |
Vec2 | _drawScale |
bool | _masseffect |
Node * | _node |
WireNode * | _debug |
string | _tag |
Circle-shaped model to support collisions.
Note that the shape must be circular, not elliptical. If you want to make an ellipse, you will need to use the PolygonObstacle class.
Unless otherwise specified, the center of mass is as the center.
|
static |
Creates a new wheel object at the origin with no radius.
|
static |
Creates a new wheel object at the given point with no radius.
The scene graph is completely decoupled from the physics system. The node does not have to be the same size as the physics body. We only guarantee that the scene graph node is positioned correctly according to the drawing scale.
pos | Initial position in world coordinates |
|
static |
Creates a new wheel object of the given radius.
The scene graph is completely decoupled from the physics system. The node does not have to be the same size as the physics body. We only guarantee that the scene graph node is positioned correctly according to the drawing scale.
pos | Initial position in world coordinates |
radius | The wheel radius |
|
overridevirtual |
Create new fixtures for this body, defining the shape
This is the primary method to override for custom physics objects
Reimplemented from SimpleObstacle.
|
inline |
Returns the radius of this circle
|
inlineoverridevirtual |
Initializes a new wheel object at the origin with no size.
Reimplemented from Obstacle.
|
inlineoverridevirtual |
Initializes a new wheel object at the given point with no size.
The scene graph is completely decoupled from the physics system. The node does not have to be the same size as the physics body. We only guarantee that the scene graph node is positioned correctly according to the drawing scale.
pos | Initial position in world coordinates |
Reimplemented from Obstacle.
|
virtual |
Initializes a new wheel object of the given dimensions.
The scene graph is completely decoupled from the physics system. The node does not have to be the same size as the physics body. We only guarantee that the scene graph node is positioned correctly according to the drawing scale.
pos | Initial position in world coordinates |
radius | The wheel radius |
|
overridevirtual |
Release the fixtures for this body, reseting the shape
This is the primary method to override for custom physics objects
Reimplemented from SimpleObstacle.
|
overrideprotectedvirtual |
Redraws the outline of the physics fixtures to the debug node
The debug node is use to outline the fixtures attached to this object. This is very useful when the fixtures have a very different shape than the texture (e.g. a circular shape attached to a square texture).
Redraws the outline of the physics fixtures to the debug node
The debug node is use to outline the fixtures attached to this object. This is very useful when the fixtures have a very different shape than the texture (e.g. a circular shape attached to a square texture).
Unfortunately, the current implementation is very inefficient. Cocos2d does not batch drawnode commands like it does Sprites or PolygonSprites. Therefore, every distinct DrawNode is a distinct OpenGL call. This can really hurt framerate when debugging mode is on. Ideally, we would refactor this so that we only draw to a single, master draw node. However, this means that we would have to handle our own vertex transformations, instead of relying on the transforms in the scene graph.
Reimplemented from Obstacle.
|
inline |
Sets the radius of this circle
value | the radius of this circle |
|
protected |
A cache value for the fixture (for resizing)
|
protected |
Shape information for this box