Total Pageviews

Friday, May 30, 2014

Type Joint (detail1)

នេះជា Type Joint របស់ Corona SDK
វាប្រើសំរាប់ joint objects ដែលប្រើក្នុងការ join two physics bodies ដែលបានបង្កើតឡើងដោយប្រើ physics.newJoint()
Box2D 2.1.1 à 2.2.1
Behavioral differences:
សំរាប់ version 2.2.1 គឺ much more sensitive ទាក់ទង់នឹង mass ratios។ សូមកុំដាក់ massed exceeed 10:1 ពីព្រោះ some joints វាមិន statble
API Changes / Updates
All Joints:
នេះជា new properties & methods ដែលមានលើគ្រប់ទាំង joints:
Joint.isActive
Joint.isCollideConnected (read-only)
Local Anchors
 joint:getLocalAnchorA() and joint:getLocalAnchorB() is available to the following joint types:
 •Distance
 •Pivot
 •Piston
 •Friction
 •Wheel
 •Weld
 •Rope
 Pivot Joints
 •joint.maxMotorTorque values can be accessed. Previously they could only be written.
 •joint.referenceAngle has been added
 Piston Joints
 •joint:getLocalAxisA() has been added
 •joint.referenceAngle has been added
 Wheel Joints
 •joint.motorForce has been changed to joint.motorTorque
 •joint.maxMotorForce has been changed to joing.maxMotorTorque
 •joint:getLocalAxisA() has been added
 •joint.springFrequency has been added
 •joint.springDampingRatio has been added
 •joint.isLimitEnabled has been removed
 •joint:getLimits() has been removed
 •joint:setLimits() has been removed
 Pulley Joints
 •joint.groundAnchorA has been added
 •joint.groundAnchorB has been added
 Weld Joints
 •joint.dampingRatio has been added
 •joint.frequency has been added
 •joint.referenceAngle has been added
Properties របស់វាមានះ
Common:
joint.isActive: ប្រើថាតើ Joint ត្រូវបានកំនត់ true or not false។ ប្រើជាមួយនឹង Pivot, Piston & Wheel joints
joint.isCollideConnected: ថាតើ joint objects នឹងតាម collision rules (true) or not (false)។ ក្នុងករណីខ្លះវាមានប្រយោជន៏ក្នុងការ joint bodies ទៅកាន់ collide (for example in a platform that’s connected to a ground body) ក្នុងករណីផ្សេងមិនសំរាប់ប្រើគ្រប់ទាំង Joints
joint.reactionTorque: វាជា read-only property ដែលត្រឡប់ជា reaction torque (in N*m) នៅ joint anchor នៅក្នុង second body។ សំរាប់ Property នេះគឺធម្មតាសំរាប់គ្រប់ទាំង joint types
សូមមើលកូដះ
Local reactionTorque = myJoint.reactionTorque        

Distance Joint
joint.dampingRatio
នេះជា joint’s damping ratio។ តំលៃត្រឹមត្រូវរបស់វាចាប់ពី 0 (no damping) រហូតដល់ 1 (critical damping)

joint.frequency
នេះជា mass spring damping frequency (គិតជា Hz) ប្រើជាមួយនឹង Distance joints

joint.length
នេះជាចំងាយនៅក្នុង Pixels  រវាង anchor points។ តំលៃដែលវា assign ទៅកាន់ Property ដែលមិនមែនជាសូន្យ។ សាកគិតថាវាប្រើនៅ pivot joint បើសិនជាវាត្រូវការ directly anchor one body to another។ សំរាប់ប្រើជាមួយនឹង Distance joints

Friction Joint
joint.maxForce
វាជាចំនួននៃ Maximum force ដែលអាច exerted នៅលើ Joint។ សំរាប់ប្រើជាមួយនឹង Friction joints
joint.maxTorque
វាជា Maximum torque ដែលអាច applied ទៅកាន់ joint។ សំរាប់ប្រើជាមួយនឹង Friction joints

Gear Joint
joint.joint1
នេះជា Property of Gear Joints, អាចជា piston of pivot joint
joint.joint2
នេះជា Property of Gear Joints, អាចជា piston of pivot joint

joint.ratio
ប្រើជាជំរើសនៅ simulator block & tackle arrangement ដែលមួយផ្នែកនៃ rope moves faster than the other។ ដោយតំលៃដើម Ratio នេះគឺ 1.0 ដែល simulates a simple pulley។ វាប្រើជាមួយនឹង Pulley joint
សូមមើលកូដះ
local myJoint = physics.newJoint( "pulley", crateA, crateB, anchorA_x,anchorA_y, anchorB_x,anchorB_y, crateA.x,crateA.y, crateB.x,crateB.y, 1.0 )
local length1 = myJoint.length1 -- (read-only; value in pixels)
local length2 = myJoint.length2 -- (read-only; value in pixels)
local ratio = myJoint.ratio -- (read-only)

No comments:

Post a Comment