Răsfoiți Sursa

[ts] Fix field initializers of PhysicsConstraintData

Mario Zechner 1 an în urmă
părinte
comite
dfc05e075e

+ 2 - 2
spine-ts/spine-core/src/PhysicsConstraintData.ts

@@ -46,8 +46,8 @@ export class PhysicsConstraintData extends ConstraintData {
 	x = 0;
 	y = 0;
 	rotate = 0;
-	scaleX = 1;
-	shearX = 1;
+	scaleX = 0;
+	shearX = 0;
 	step = 0;
 	inertia = 0;
 	strength = 0;

+ 3 - 3
spine-ts/spine-webgl/example/physics.html

@@ -36,7 +36,7 @@
 				var skeletonBinary = new spine.SkeletonBinary(atlasLoader);
 
 				// Set the scale to apply during parsing, parse the file, and create a new skeleton.
-				skeletonBinary.scale = 1;
+				skeletonBinary.scale = 0.2;
 				var skeletonData = skeletonBinary.readSkeletonData(assetManager.require("assets/sack-pro.skel"));
 				this.skeleton = new spine.Skeleton(skeletonData);
 
@@ -51,9 +51,9 @@
 				this.animationState.update(delta);
 				// Apply the animation state to the skeleton.
 				this.animationState.apply(this.skeleton);
-				// Let the skeleton update the transforms of its bones.
-				this.skeleton.updateWorldTransform(spine.Physics.update);
+				// Let the skeleton update the transforms of its bones and apply physics
 				this.skeleton.update(delta);
+				this.skeleton.updateWorldTransform(spine.Physics.update);
 			}
 
 			render(canvas) {