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

Hinge constraint restricts two additional angular degrees of freedom, so the body can only rotate around one axis, the hinge axis. More...

Inherits Physics3DConstraint.

Public Member Functions

cocos2d::Mat4 getFrameOffsetA () const
 get rigid body A's frame offset rigid body A's frame offset
 
cocos2d::Mat4 getFrameOffsetB () const
 get rigid body B's frame offset rigid body B's frame offset
 
void setFrames (const cocos2d::Mat4 &frameA, const cocos2d::Mat4 &frameB)
 set frames for rigid body A and B frame will be seted to rigid body A frame will be seted to rigid body B
 
local setFrames ( local frameA, local frameB)
 set frames for rigid body A and B frame will be seted to rigid body A frame will be seted to rigid body B
 
void setAngularOnly (bool angularOnly)
 set angular only angular will be set
 
void enableAngularMotor (bool enableMotor, float targetVelocity, float maxMotorImpulse)
 enable angular motor whether to enable AngularMotor target velocity max motor impulse
 
void enableMotor (bool enableMotor)
 extra motor API, including ability to set a target rotation (as opposed to angular velocity) whether to enable AngularMotor
 
void setMaxMotorImpulse (float maxMotorImpulse)
 set max motor impulse max motor impulse
 
void setMotorTarget (const cocos2d::Quaternion &qAinB, float dt)
 set motor target
 
void setMotorTarget (float targetAngle, float dt)
 set motor target
 
void setLimit (float low, float high, float _softness=0.9f, float _biasFactor=0.3f, float _relaxationFactor=1.0f)
 set limit
 
var setLimit ( var low, var high, var 9f, var 3f, var 0f)
 set limit
 
local setLimit ( local low, local high, local 9f, local 3f, local 0f)
 set limit
 
void setAxis (const cocos2d::Vec3 &axisInA)
 set axis
 
float getLowerLimit () const
 get lower limit
 
float getUpperLimit () const
 get upper limit
 
var getUpperLimit ()
 get upper limit
 
local getUpperLimit ()
 get upper limit
 
float getHingeAngle () const
 get hinge angle
 
var getHingeAngle ()
 get hinge angle
 
local getHingeAngle ()
 get hinge angle
 
float getHingeAngle (const cocos2d::Mat4 &transA, const cocos2d::Mat4 &transB)
 get hinge angle
 
var getHingeAngle ( var transA, var transB)
 get hinge angle
 
local getHingeAngle ( local transA, local transB)
 get hinge angle
 
cocos2d::Mat4 getAFrame () const
 get A's frame
 
cocos2d::Mat4 getBFrame () const
 get B's frame
 
local getBFrame ()
 get B's frame
 
bool getAngularOnly () const
 get angular only
 
var getAngularOnly ()
 get angular only
 
local getAngularOnly ()
 get angular only
 
bool getEnableAngularMotor () const
 get enable angular motor
 
var getEnableAngularMotor ()
 get enable angular motor
 
local getEnableAngularMotor ()
 get enable angular motor
 
float getMotorTargetVelosity () const
 get motor target velosity
 
float getMaxMotorImpulse () const
 get max motor impulse
 
bool getUseFrameOffset () const
 access for UseFrameOffset
 
local getUseFrameOffset ()
 access for UseFrameOffset
 
void setUseFrameOffset (bool frameOffsetOnOff)
 set use frame offset
 
- Public Member Functions inherited from Physics3DConstraint
float getBreakingImpulse () const
 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
 
Physics3DRigidBodygetBodyB () const
 get rigid body b the Physics3DRigidBody B
 
ConstraintType getConstraintType () const
 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
 
local setOverrideNumSolverIterations ( local 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 Physics3DHingeConstraintcreate (Physics3DRigidBody *rbA, const cocos2d::Mat4 &rbAFrame, bool useReferenceFrameA=false)
 create hinge constraint rigid body A rigid body A's frame use frame A as reference return an autoreleased Physics3DHingeConstraint object.
 
var create ( var rbA, var rbAFrame, var false)
 create hinge constraint rigid body A rigid body A's frame use frame A as reference return an autoreleased Physics3DHingeConstraint object.
 
local create ( local rbA, local rbAFrame, local false)
 create hinge constraint rigid body A rigid body A's frame use frame A as reference return an autoreleased Physics3DHingeConstraint object.
 
static Physics3DHingeConstraintcreate (Physics3DRigidBody *rbA, const cocos2d::Vec3 &pivotInA, const cocos2d::Vec3 &axisInA, bool useReferenceFrameA=false)
 create hinge constraint rigid body A pivot in rigid body A's local space axis in rigid body A's local space use frame A as reference return an autoreleased Physics3DHingeConstraint object.
 
static Physics3DHingeConstraintcreate (Physics3DRigidBody *rbA, Physics3DRigidBody *rbB, const cocos2d::Vec3 &pivotInA, const cocos2d::Vec3 &pivotInB, cocos2d::Vec3 &axisInA, cocos2d::Vec3 &axisInB, bool useReferenceFrameA=false)
 create hinge constraint rigid body A rigid body B pivot point in A's local space pivot point in B's local space axis in A's local space axis in B's local space use frame A as reference return an autoreleased Physics3DHingeConstraint object.
 
var create ( var rbA, var rbB, var pivotInA, var pivotInB, var axisInA, var axisInB, var false)
 create hinge constraint rigid body A rigid body B pivot point in A's local space pivot point in B's local space axis in A's local space axis in B's local space use frame A as reference return an autoreleased Physics3DHingeConstraint object.
 
local create ( local rbA, local rbB, local pivotInA, local pivotInB, local axisInA, local axisInB, local false)
 create hinge constraint rigid body A rigid body B pivot point in A's local space pivot point in B's local space axis in A's local space axis in B's local space use frame A as reference return an autoreleased Physics3DHingeConstraint object.
 
static Physics3DHingeConstraintcreate (Physics3DRigidBody *rbA, Physics3DRigidBody *rbB, const cocos2d::Mat4 &rbAFrame, const cocos2d::Mat4 &rbBFrame, bool useReferenceFrameA=false)
 create hinge constraint rigid body A rigid body B rigid body A's frame rigid body B's frame use frame A as reference return an autoreleased Physics3DHingeConstraint object.
 

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

Hinge constraint restricts two additional angular degrees of freedom, so the body can only rotate around one axis, the hinge axis.

This can be useful to represent doors or wheels rotating around one axis. hinge constraint between two rigidbodies each with a pivotpoint that descibes the axis location in local space


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