CCPhysicsSprite Class Reference
| Inherits from | CCSprite : CCNodeRGBA : CCNode : NSObject |
| Declared in | CCPhysicsSprite.h CCPhysicsSprite.mm |
Overview
A CCSprite subclass that is bound to a physics body. It works with:
- Chipmunk: Preprocessor macro CC_ENABLE_CHIPMUNK_INTEGRATION should be defined
- Objective-Chipmunk: Preprocessor macro CC_ENABLE_CHIPMUNK_INTEGRATION should be defined
- Box2d: Preprocessor macro CC_ENABLE_BOX2D_INTEGRATION should be defined
Features and Limitations:
- Scale and Skew properties are ignored.
- Position and rotation are going to updated from the physics body
- If you update the rotation or position manually, the physics body will be updated
- You can't eble both Chipmunk support and Box2d support at the same time. Only one can be enabled at compile time
Tasks
Other Methods
-
ignoreBodyRotationKeep the sprite’s rotation separate from the body.
property -
CPBodyBody accessor when using regular Chipmunk
property -
chipmunkBodyBody accessor when using Objective-Chipmunk
property -
b2BodyBody accessor when using box2d
property -
PTMRatioproperty
Other Methods
-
– positionPosition (x,y) of the node in points. (0,0) is the left-bottom corner.
-
– setPosition:Position (x,y) of the node in points. (0,0) is the left-bottom corner.
-
– rotationThe rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node CW.
-
– setRotation:The rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node CW.
-
– nodeToParentTransformReturns the matrix that transform the node’s (local) space coordinates into the parent’s space coordinates. The matrix is in Pixels.
-
– dirtywhether or not the Sprite needs to be updated in the Atlas
Properties
CPBody
Body accessor when using regular Chipmunk
@property (nonatomic, assign) cpBody *CPBodyDeclared In
CCPhysicsSprite.hb2Body
Body accessor when using box2d
@property (nonatomic, assign) *b2BodyDeclared In
CCPhysicsSprite.hInstance Methods
dirty
whether or not the Sprite needs to be updated in the Atlas
- (BOOL)dirtyDeclared In
CCSprite.hnodeToParentTransform
Returns the matrix that transform the node’s (local) space coordinates into the parent’s space coordinates. The matrix is in Pixels.
- (CGAffineTransform)nodeToParentTransformAvailability
Declared In
CCNode.hposition
Position (x,y) of the node in points. (0,0) is the left-bottom corner.
- (CGPoint)positionDeclared In
CCNode.hrotation
The rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node CW.
- (float)rotationDeclared In
CCNode.h