LHNodePhysicsProtocol Protocol Reference

LHNodePhysicsProtocol.h

Instance Methods

physicsType

- (int)physicsType
Return Value

A LH_PHYSICS_TYPE enum value; 0 = static, 1 = Kinematic (not available in Chipmunk), 2 = Dynamic, 3 = No Physics

Discussion

Returns the type of the physics body.

Declared In
LHNodePhysicsProtocol.h

removeBody

- (void)removeBody
Discussion

Removed the physics body from the node. The Cocos2d node will still be alive. If you want to remove the node call "removeFromParent" instead. Note that you won't be able to recreate the body after removal without recreating the entire Cocos2d node. If you need the physics body at a later time you may want to change the physics type to No Physics.

Declared In
LHNodePhysicsProtocol.h

setPhysicsType:

- (void)setPhysicsType:(int)type
Parameters
type

A LH_PHYSICS_TYPE enum value. 0 = static, 1 = Kinematic (not available in Chipmunk), 2 = Dynamic, 3 = No Physics

Discussion

Set the physics body type; Note: On Box2d setting a body to No Physics type will not actually delete the body but will make it inactive. It will no longer participate in physics simulation, but it will still exist in order to make it dynamic/static later on. Node: On Chipmunk setting a body to No Physics will make it static and sensor. Setting it back to static/dynamic will set the initial sensor state.

If you really want to delete the body use the appropriate method to do so. After deleting the body you will no longer be able to set it back again until you recreate the Cocos2d node.

Declared In
LHNodePhysicsProtocol.h
Last updated: 2015-2-12

Back to top

Copyright © VLADU BOGDAN DANIEL PFA.