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

The physics information container, include Physics3DObjects, Physics3DConstraints, collision information and so on. More...

Inherits Ref.

Public Member Functions

void setGravity (const Vec3 &gravity)
 Set gravity for the physics world Gravity to be set.
 
Vec3 getGravity () const
 Get current gravity.
 
void addPhysics3DObject (Physics3DObject *physicsObj)
 Add a Physics3DObject.
 
var addPhysics3DObject ( var physicsObj)
 Add a Physics3DObject.
 
local addPhysics3DObject ( local physicsObj)
 Add a Physics3DObject.
 
void removePhysics3DObject (Physics3DObject *physicsObj)
 Remove a Physics3DObject.
 
void removeAllPhysics3DObjects ()
 Remove all Physics3DObjects.
 
void addPhysics3DConstraint (Physics3DConstraint *constraint, bool disableCollisionsBetweenLinkedObjs=true)
 Add a Physics3DConstraint.
 
void removePhysics3DConstraint (Physics3DConstraint *constraint)
 Remove a Physics3DConstraint.
 
void removeAllPhysics3DConstraints ()
 Remove all Physics3DConstraint.
 
void stepSimulate (float dt)
 Simulate one frame.
 
void setDebugDrawEnable (bool enableDebugDraw)
 Enable or disable debug drawing.
 
bool isDebugDrawEnabled () const
 Check debug drawing is enabled.
 
void debugDraw (cocos2d::Renderer *renderer)
 Internal method, the updater of debug drawing, need called each frame.
 
const std::vector
< Physics3DObject * > & 
getPhysicsObjects () const
 Get the list of Physics3DObjects.
 
local getPhysicsObjects ()
 Get the list of Physics3DObjects.
 
bool rayCast (const cocos2d::Vec3 &startPos, const cocos2d::Vec3 &endPos, HitResult *result)
 Ray cast method The start position of ray. More...
 
local rayCast ( local startPos, local endPos, local result)
 Ray cast method The start position of ray. More...
 
bool sweepShape (Physics3DShape *shape, const cocos2d::Mat4 &startTransform, const cocos2d::Mat4 &endTransform, HitResult *result)
 Performs a swept shape cast on all objects in the Physics3DWorld.
 
- 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 Physics3DWorldcreate (Physics3DWorldDes *info)
 Creates a Physics3DWorld with Physics3DWorldDes. More...
 
local create ( local info)
 Creates a Physics3DWorld with Physics3DWorldDes. 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

The physics information container, include Physics3DObjects, Physics3DConstraints, collision information and so on.

Member Function Documentation

static Physics3DWorld* create ( Physics3DWorldDes info)
static

Creates a Physics3DWorld with Physics3DWorldDes.

An autoreleased Physics3DWorld object.

var create ( var  info)
static

Creates a Physics3DWorld with Physics3DWorldDes.

An autoreleased Physics3DWorld object.

local create ( local  info)
static

Creates a Physics3DWorld with Physics3DWorldDes.

An autoreleased Physics3DWorld object.

bool rayCast ( const cocos2d::Vec3 startPos,
const cocos2d::Vec3 endPos,
HitResult *  result 
)

Ray cast method The start position of ray.

The end position of ray. the result of ray cast.

var rayCast ( var  startPos,
var  endPos,
var  result 
)

Ray cast method The start position of ray.

The end position of ray. the result of ray cast.

local rayCast ( local  startPos,
local  endPos,
local  result 
)

Ray cast method The start position of ray.

The end position of ray. the result of ray cast.


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