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

Inherit from Physics3DObject, the main class for rigid body objects. More...

Inherits Physics3DObject.

Public Member Functions

btRigidBody * getRigidBody () const
 Get the pointer of btRigidBody.
 
void applyForce (const cocos2d::Vec3 &force, const cocos2d::Vec3 &rel_pos)
 Apply a force. More...
 
local applyForce ( local force, local rel_pos)
 Apply a force. More...
 
void applyCentralForce (const cocos2d::Vec3 &force)
 Apply a central force. More...
 
local applyCentralForce ( local force)
 Apply a central force. More...
 
void applyCentralImpulse (const cocos2d::Vec3 &impulse)
 Apply a central impulse. More...
 
void applyTorque (const cocos2d::Vec3 &torque)
 Apply a torque. More...
 
void applyTorqueImpulse (const cocos2d::Vec3 &torque)
 Apply a torque impulse. More...
 
void applyImpulse (const cocos2d::Vec3 &impulse, const cocos2d::Vec3 &rel_pos)
 Apply a impulse. More...
 
void applyDamping (float timeStep)
 Damps the velocity, using the given linearDamping and angularDamping.
 
void setLinearVelocity (const cocos2d::Vec3 &lin_vel)
 Set the linear velocity.
 
cocos2d::Vec3 getLinearVelocity () const
 Get the linear velocity.
 
void setLinearFactor (const cocos2d::Vec3 &linearFactor)
 Set the linear factor.
 
cocos2d::Vec3 getLinearFactor () const
 Get the linear factor.
 
void setAngularFactor (const cocos2d::Vec3 &angFac)
 Set the angular factor.
 
var setAngularFactor ( var angFac)
 Set the angular factor.
 
local setAngularFactor ( local angFac)
 Set the angular factor.
 
void setAngularFactor (float angFac)
 Set the angular factor, use unified factor.
 
cocos2d::Vec3 getAngularFactor () const
 Get the angular factor.
 
void setAngularVelocity (const cocos2d::Vec3 &ang_vel)
 Set the angular velocity.
 
cocos2d::Vec3 getAngularVelocity () const
 Get the angular velocity.
 
void setCenterOfMassTransform (const cocos2d::Mat4 &xform)
 Set the center of mass.
 
cocos2d::Mat4 getCenterOfMassTransform () const
 Get the center of mass.
 
var getCenterOfMassTransform ()
 Get the center of mass.
 
local getCenterOfMassTransform ()
 Get the center of mass.
 
void setDamping (float lin_damping, float ang_damping)
 Set linear damping and angular damping.
 
float getLinearDamping () const
 Get linear damping.
 
float getAngularDamping () const
 Get angular damping.
 
void setGravity (const cocos2d::Vec3 &acceleration)
 Set the acceleration.
 
cocos2d::Vec3 getGravity () const
 Get the acceleration.
 
void setInvInertiaDiagLocal (const cocos2d::Vec3 &diagInvInertia)
 Set the inverse of local inertia.
 
var setInvInertiaDiagLocal ( var diagInvInertia)
 Set the inverse of local inertia.
 
local setInvInertiaDiagLocal ( local diagInvInertia)
 Set the inverse of local inertia.
 
cocos2d::Vec3 getInvInertiaDiagLocal () const
 Get the inverse of local inertia.
 
void setMassProps (float mass, const cocos2d::Vec3 &inertia)
 Set mass and inertia.
 
local setMassProps ( local mass, local inertia)
 Set mass and inertia.
 
float getInvMass () const
 Get inverse of mass.
 
cocos2d::Vec3 getTotalForce () const
 Get total force.
 
var getTotalForce ()
 Get total force.
 
local getTotalForce ()
 Get total force.
 
cocos2d::Vec3 getTotalTorque () const
 Get total torque.
 
local getTotalTorque ()
 Get total torque.
 
void setRestitution (float rest)
 Set restitution.
 
float getRestitution () const
 Get restitution.
 
void setFriction (float frict)
 Set friction.
 
float getFriction () const
 Get friction.
 
void setRollingFriction (float frict)
 Set rolling friction.
 
var setRollingFriction ( var frict)
 Set rolling friction.
 
local setRollingFriction ( local frict)
 Set rolling friction.
 
float getRollingFriction () const
 Get rolling friction.
 
void setHitFraction (float hitFraction)
 Set hit friction.
 
float getHitFraction () const
 Get hit friction.
 
void setCcdMotionThreshold (float ccdMotionThreshold)
 Set motion threshold, don't do continuous collision detection if the motion (in one step) is less then ccdMotionThreshold.
 
float getCcdMotionThreshold () const
 Get motion threshold.
 
void setCcdSweptSphereRadius (float radius)
 Set swept sphere radius.
 
float getCcdSweptSphereRadius () const
 Get swept sphere radius.
 
void setKinematic (bool kinematic)
 Set kinematic object.
 
bool isKinematic () const
 Check rigid body is kinematic object.
 
virtual cocos2d::Mat4 getWorldTransform () const override
 override.
 
local getWorldTransform ()
 override.
 
Physics3DConstraintgetConstraint (unsigned int idx) const
 Get constraint by index.
 
unsigned int getConstraintCount () const
 Get the total number of constraints.
 
void setActive (bool active)
 Active or inactive.
 
- Public Member Functions inherited from Physics3DObject
virtual PhysicsObjType getObjType () const
 Get the Physics3DObject Type.
 
local getObjType ()
 Get the Physics3DObject Type.
 
void setUserData (void *userData)
 Set the user data.
 
void * getUserData () const
 Get the user data.
 
void setPhysicsWorld (Physics3DWorld *world)
 Internal method. More...
 
Physics3DWorldgetPhysicsWorld () const
 Get the pointer of Physics3DWorld.
 
void setCollisionCallback (const CollisionCallbackFunc &func)
 Set the collision callback function.
 
const CollisionCallbackFunc & getCollisionCallback () const
 Get the collision callback function.
 
bool needCollisionCallback ()
 Check has collision callback function.
 
void setMask (unsigned int mask)
 Set the mask of Physics3DObject.
 
unsigned int getMask () const
 Get the mask of Physics3DObject.
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
local retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
local getReferenceCount ()
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor.
 

Static Public Member Functions

static Physics3DRigidBodycreate (Physics3DRigidBodyDes *info)
 Creates a Physics3DRigidBody with Physics3DRigidBody. More...
 
local create ( local info)
 Creates a Physics3DRigidBody with Physics3DRigidBody. More...
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
local _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
local _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
local _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
local _rooted
 When true, it means that the object was already rooted.
 
bool _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 
local _scriptOwned
 The life of the object is scrolled by the scripting engine. More...
 

Detailed Description

Inherit from Physics3DObject, the main class for rigid body objects.

Member Function Documentation

static Physics3DRigidBody* create ( Physics3DRigidBodyDes info)
static

Creates a Physics3DRigidBody with Physics3DRigidBody.

An autoreleased Physics3DRigidBody object.

var create ( var  info)
static

Creates a Physics3DRigidBody with Physics3DRigidBody.

An autoreleased Physics3DRigidBody object.

local create ( local  info)
static

Creates a Physics3DRigidBody with Physics3DRigidBody.

An autoreleased Physics3DRigidBody object.

void applyForce ( const cocos2d::Vec3 force,
const cocos2d::Vec3 rel_pos 
)

Apply a force.

the value of the force the position of the force

var applyForce ( var  force,
var  rel_pos 
)

Apply a force.

the value of the force the position of the force

local applyForce ( local  force,
local  rel_pos 
)

Apply a force.

the value of the force the position of the force

void applyCentralForce ( const cocos2d::Vec3 force)

Apply a central force.

the value of the force

var applyCentralForce ( var  force)

Apply a central force.

the value of the force

local applyCentralForce ( local  force)

Apply a central force.

the value of the force

void applyCentralImpulse ( const cocos2d::Vec3 impulse)

Apply a central impulse.

the value of the impulse

var applyCentralImpulse ( var  impulse)

Apply a central impulse.

the value of the impulse

local applyCentralImpulse ( local  impulse)

Apply a central impulse.

the value of the impulse

void applyTorque ( const cocos2d::Vec3 torque)

Apply a torque.

the value of the torque

var applyTorque ( var  torque)

Apply a torque.

the value of the torque

local applyTorque ( local  torque)

Apply a torque.

the value of the torque

void applyTorqueImpulse ( const cocos2d::Vec3 torque)

Apply a torque impulse.

the value of the torque

var applyTorqueImpulse ( var  torque)

Apply a torque impulse.

the value of the torque

local applyTorqueImpulse ( local  torque)

Apply a torque impulse.

the value of the torque

void applyImpulse ( const cocos2d::Vec3 impulse,
const cocos2d::Vec3 rel_pos 
)

Apply a impulse.

the value of the impulse

var applyImpulse ( var  impulse,
var  rel_pos 
)

Apply a impulse.

the value of the impulse

local applyImpulse ( local  impulse,
local  rel_pos 
)

Apply a impulse.

the value of the impulse


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