Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
Physics3DComponent Class Reference

A component with 3D physics, you can add a rigid body to it, and then add this component to a node, the node will move and rotate with this rigid body. More...

Inherits Component.

Public Member Functions

virtual ~Physics3DComponent ()
 destructor
 
virtual bool init () override
 initialize
 
void setPhysics3DObject (Physics3DObject *physicsObj)
 set Physics object to the component the physics object that will be seted
 
Physics3DObjectgetPhysics3DObject () const
 get physics object the physics object
 
virtual void setEnabled (bool b) override
 set it enable or not set ture to enable this component reverse otherwise
 
void addToPhysicsWorld (Physics3DWorld *world)
 add this component to physics world, called by scene the physics world which this component will be added
 
var addToPhysicsWorld ( var world)
 add this component to physics world, called by scene the physics world which this component will be added
 
local addToPhysicsWorld ( local world)
 add this component to physics world, called by scene the physics world which this component will be added
 
void setTransformInPhysics (const cocos2d::Vec3 &translateInPhysics, const cocos2d::Quaternion &rotInPhsyics)
 The translation in physics object space the transfrom in physics object space the quaternion in physics object space.
 
void setSyncFlag (PhysicsSyncFlag syncFlag)
 synchronization between node and physics is time consuming, you can skip some synchronization using this function the synchroniztion of component
 
void syncNodeToPhysics ()
 align node and physics according to physics object
 
void syncPhysicsToNode ()
 align node and physics according to node
 

Static Public Member Functions

static Physics3DComponentcreate (Physics3DObject *physicsObj, const cocos2d::Vec3 &translateInPhysics=cocos2d::Vec3::ZERO, const cocos2d::Quaternion &rotInPhsyics=cocos2d::Quaternion::ZERO)
 create Physics3DComponent pointer to a Physics object contain in the component offset that the owner node in the physics object's space offset rotation that the owner node in the physics object's space created Physics3DComponent
 
local create ( local physicsObj, local ZERO, local ZERO)
 create Physics3DComponent pointer to a Physics object contain in the component offset that the owner node in the physics object's space offset rotation that the owner node in the physics object's space created Physics3DComponent
 
static std::string & getPhysics3DComponentName ()
 get the component name, it is used to find whether it is Physics3DComponent the name of component name
 

Detailed Description

A component with 3D physics, you can add a rigid body to it, and then add this component to a node, the node will move and rotate with this rigid body.


The documentation for this class was generated from the following file: