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

It is a special point to point constraint that adds cone and twist axis limits. More...

Inherits Physics3DConstraint.

Public Member Functions

void setLimit (float swingSpan1, float swingSpan2, float twistSpan, float softness=1.f, float biasFactor=0.3f, float relaxationFactor=1.0f)
 set limits swing span1 swing span2 twist span 0->1, recommend ~0.8->1. More...
 
var setLimit ( var swingSpan1, var swingSpan2, var twistSpan, var f, var 3f, var 0f)
 set limits swing span1 swing span2 twist span 0->1, recommend ~0.8->1. More...
 
local setLimit ( local swingSpan1, local swingSpan2, local twistSpan, local f, local 3f, local 0f)
 set limits swing span1 swing span2 twist span 0->1, recommend ~0.8->1. More...
 
cocos2d::Mat4 getAFrame () const
 get A's frame
 
cocos2d::Mat4 getBFrame () const
 get B's frame
 
float getSwingSpan1 () const
 get swing span1
 
var getSwingSpan1 ()
 get swing span1
 
local getSwingSpan1 ()
 get swing span1
 
float getSwingSpan2 () const
 get swing span2
 
float getTwistSpan () const
 get twist span
 
var getTwistSpan ()
 get twist span
 
local getTwistSpan ()
 get twist span
 
float getTwistAngle () const
 get twist angle
 
void setDamping (float damping)
 set damping
 
void enableMotor (bool b)
 enable motor
 
void setMaxMotorImpulse (float maxMotorImpulse)
 set max motor impulse
 
var setMaxMotorImpulse ( var maxMotorImpulse)
 set max motor impulse
 
local setMaxMotorImpulse ( local maxMotorImpulse)
 set max motor impulse
 
void setMaxMotorImpulseNormalized (float maxMotorImpulse)
 set max motor impulse normalize
 
float getFixThresh () const
 get fix thresh
 
void setFixThresh (float fixThresh)
 set fix thresh
 
var setFixThresh ( var fixThresh)
 set fix thresh
 
local setFixThresh ( local fixThresh)
 set fix thresh
 
void setMotorTarget (const btQuaternion &q)
 setMotorTarget the desired rotation of bodyA wrt bodyB. More...
 
var setMotorTarget ( var q)
 setMotorTarget the desired rotation of bodyA wrt bodyB. More...
 
local setMotorTarget ( local q)
 setMotorTarget the desired rotation of bodyA wrt bodyB. More...
 
void setMotorTargetInConstraintSpace (const btQuaternion &q)
 setMotorTarget, q is the desired rotation of frameA wrt frameB in constraint space
 
cocos2d::Vec3 GetPointForAngle (float fAngleInRadians, float fLength) const
 get point for angle
 
virtual void setFrames (const cocos2d::Mat4 &frameA, const cocos2d::Mat4 &frameB)
 set A and B's frame
 
cocos2d::Mat4 getFrameOffsetA () const
 get A's frame offset
 
cocos2d::Mat4 getFrameOffsetB () const
 get B's frame offset
 
- Public Member Functions inherited from Physics3DConstraint
float getBreakingImpulse () const
 get the impulse that break the constraint the impulse that break the constraint
 
var getBreakingImpulse ()
 get the impulse that break the constraint the impulse that break the constraint
 
local getBreakingImpulse ()
 get the impulse that break the constraint the impulse that break the constraint
 
void setBreakingImpulse (float impulse)
 set the impulse that break the constraint the impulse that break the constraint
 
bool isEnabled () const
 is it enabled whether the constraint is enabled
 
void setEnabled (bool enabled)
 set enable or not whether the constraint will be enabled
 
Physics3DRigidBodygetBodyA () const
 get rigid body a the Physics3DRigidBody A
 
local getBodyA ()
 get rigid body a the Physics3DRigidBody A
 
Physics3DRigidBodygetBodyB () const
 get rigid body b the Physics3DRigidBody B
 
local getBodyB ()
 get rigid body b the Physics3DRigidBody B
 
ConstraintType getConstraintType () const
 get constraint type the constraint type
 
var getConstraintType ()
 get constraint type the constraint type
 
local getConstraintType ()
 get constraint type the constraint type
 
void setUserData (void *userData)
 get user data the user data will be seted
 
void * getUserData () const
 get user data the user data
 
int getOverrideNumSolverIterations () const
 get override number of solver iterations the override number of solver iterations
 
void setOverrideNumSolverIterations (int overideNumIterations)
 override the number of constraint solver iterations used to solve this constraint, -1 will use the default number of iterations, as specified in SolverInfo.m_numIterations the number of constraint solver iterations
 
- 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
Physics3DConeTwistConstraint
create (Physics3DRigidBody *rbA, const cocos2d::Mat4 &frameA)
 create cone twist constraint
 
local create ( local rbA, local frameA)
 create cone twist constraint
 
static
Physics3DConeTwistConstraint
create (Physics3DRigidBody *rbA, Physics3DRigidBody *rbB, const cocos2d::Mat4 &frameA, const cocos2d::Mat4 &frameB)
 create cone twist constraint
 
var create ( var rbA, var rbB, var frameA, var frameB)
 create cone twist constraint
 
local create ( local rbA, local rbB, local frameA, local frameB)
 create cone twist constraint
 

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

It is a special point to point constraint that adds cone and twist axis limits.

The x-axis serves as twist axis.

Member Function Documentation

void setLimit ( float  swingSpan1,
float  swingSpan2,
float  twistSpan,
float  softness = 1.f,
float  biasFactor = 0.3f,
float  relaxationFactor = 1.0f 
)

set limits swing span1 swing span2 twist span 0->1, recommend ~0.8->1.

Describes % of limits where movement is free. Beyond this softness %, the limit is gradually enforced until the "hard" (1.0) limit is reached. 0->1?, recommend 0.3 +/-0.3 or so. Strength with which constraint resists zeroth order (angular, not angular velocity) limit violation. 0->1, recommend to stay near 1. the lower the value, the less the constraint will fight velocities which violate the angular limits.

var setLimit ( var  swingSpan1,
var  swingSpan2,
var  twistSpan,
var  softness = 1.f,
var  biasFactor = 0.3f,
var  relaxationFactor = 1.0f 
)

set limits swing span1 swing span2 twist span 0->1, recommend ~0.8->1.

Describes % of limits where movement is free. Beyond this softness %, the limit is gradually enforced until the "hard" (1.0) limit is reached. 0->1?, recommend 0.3 +/-0.3 or so. Strength with which constraint resists zeroth order (angular, not angular velocity) limit violation. 0->1, recommend to stay near 1. the lower the value, the less the constraint will fight velocities which violate the angular limits.

local setLimit ( local  swingSpan1,
local  swingSpan2,
local  twistSpan,
local  softness = 1.f,
local  biasFactor = 0.3f,
local  relaxationFactor = 1.0f 
)

set limits swing span1 swing span2 twist span 0->1, recommend ~0.8->1.

Describes % of limits where movement is free. Beyond this softness %, the limit is gradually enforced until the "hard" (1.0) limit is reached. 0->1?, recommend 0.3 +/-0.3 or so. Strength with which constraint resists zeroth order (angular, not angular velocity) limit violation. 0->1, recommend to stay near 1. the lower the value, the less the constraint will fight velocities which violate the angular limits.

void setMotorTarget ( const btQuaternion &  q)

setMotorTarget the desired rotation of bodyA wrt bodyB.

Note: if q violates the joint limits, the internal target is clamped to avoid conflicting impulses (very bad for stability), also don't forget to enableMotor()

var setMotorTarget ( var  q)

setMotorTarget the desired rotation of bodyA wrt bodyB.

Note: if q violates the joint limits, the internal target is clamped to avoid conflicting impulses (very bad for stability), also don't forget to enableMotor()

local setMotorTarget ( local  q)

setMotorTarget the desired rotation of bodyA wrt bodyB.

Note: if q violates the joint limits, the internal target is clamped to avoid conflicting impulses (very bad for stability), also don't forget to enableMotor()


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