@@ -966,13 +966,24 @@ -(void)readJoint
966
966
967
967
if ([className isEqualToString: @" CCPhysicsPivotJoint" ])
968
968
{
969
+ if ([properties[@" motorEnabled" ] boolValue ])
970
+ {
971
+ float motorRate = properties[@" motorRate" ] ? [properties[@" motorRate" ] floatValue ] : 1 .0f ;
972
+ CCPhysicsJoint * motorJoint = [CCPhysicsJoint connectedMotorJointWithBodyA: nodeBodyA.physicsBody bodyB: nodeBodyB.physicsBody rate: motorRate];
973
+
974
+ motorJoint.maxForce = maxForce;
975
+ motorJoint.breakingForce = breakingForce;
976
+ motorJoint.collideBodies = collideBodies;
977
+ }
969
978
970
979
if ([properties[@" dampedSpringEnabled" ] boolValue ])
971
980
{
972
981
float restAngle = properties[@" dampedSpringRestAngle" ] ? [properties[@" dampedSpringRestAngle" ] floatValue ] : 0 .0f ;
973
982
restAngle = CC_DEGREES_TO_RADIANS (restAngle);
974
983
float stiffness = properties[@" dampedSpringStiffness" ] ? [properties[@" dampedSpringStiffness" ] floatValue ] : 1 .0f ;
984
+ stiffness *= 1000 .0f ;
975
985
float damping = properties[@" dampedSpringDamping" ] ? [properties[@" dampedSpringDamping" ] floatValue ] : 4 .0f ;
986
+ damping *= 100 .0f ;
976
987
977
988
CCPhysicsJoint * rotarySpringJoint = [CCPhysicsJoint connectedRotarySpringJointWithBodyA: nodeBodyA.physicsBody bodyB: nodeBodyB.physicsBody restAngle: restAngle stifness: stiffness damping: damping];
978
989
@@ -981,11 +992,12 @@ -(void)readJoint
981
992
rotarySpringJoint.collideBodies = collideBodies;
982
993
}
983
994
995
+
984
996
if ([properties[@" limitEnabled" ] boolValue ])
985
997
{
986
998
float limitMax = properties[@" limitMax" ] ? [properties[@" limitMax" ] floatValue ] : 90 .0f ;
987
999
limitMax = CC_DEGREES_TO_RADIANS (limitMax);
988
-
1000
+
989
1001
float limitMin = properties[@" limitMin" ] ? [properties[@" limitMin" ] floatValue ] : 0 ;
990
1002
limitMin = CC_DEGREES_TO_RADIANS (limitMin);
991
1003
@@ -995,17 +1007,7 @@ -(void)readJoint
995
1007
limitJoint.breakingForce = breakingForce;
996
1008
limitJoint.collideBodies = collideBodies;
997
1009
}
998
-
999
- if ([properties[@" motorEnabled" ] boolValue ])
1000
- {
1001
- float motorRate = properties[@" motorRate" ] ? [properties[@" motorRate" ] floatValue ] : 1 .0f ;
1002
- CCPhysicsJoint * motorJoint = [CCPhysicsJoint connectedMotorJointWithBodyA: nodeBodyA.physicsBody bodyB: nodeBodyB.physicsBody rate: motorRate];
1003
1010
1004
- motorJoint.maxForce = maxForce;
1005
- motorJoint.breakingForce = breakingForce;
1006
- motorJoint.collideBodies = collideBodies;
1007
- }
1008
-
1009
1011
if ([properties[@" ratchetEnabled" ] boolValue ])
1010
1012
{
1011
1013
float ratchetValue = properties[@" ratchetValue" ] ? [properties[@" ratchetValue" ] floatValue ] : 30 .0f ;
@@ -1036,6 +1038,7 @@ -(void)readJoint
1036
1038
1037
1039
BOOL restLengthEnabled = [properties[@" restLengthEnabled" ] boolValue ];
1038
1040
float restLength = restLengthEnabled? [properties[@" restLength" ] floatValue ] : distance;
1041
+
1039
1042
float stiffness = [properties[@" stiffness" ] floatValue ];
1040
1043
float damping = [properties[@" damping" ] floatValue ];
1041
1044
0 commit comments