Bring back old rope behaviour when changing its length (that's more correct physical model)
authorunc0rr
Sun, 28 Dec 2008 15:42:55 +0000
changeset 1552 cd907418da91
parent 1551 c747e69f98f3
child 1553 77f326c7f0ef
Bring back old rope behaviour when changing its length (that's more correct physical model)
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Fri Dec 26 19:34:05 2008 +0000
+++ b/hedgewars/GSHandlers.inc	Sun Dec 28 15:42:55 2008 +0000
@@ -723,8 +723,8 @@
 cc:= cc * len;
 cs:= cs * len;
 
-HHGear^.dX:= Gear^.X + cc*Gear^.Elasticity - HHGear^.X;
-HHGear^.dY:= Gear^.Y + cs*Gear^.Elasticity - HHGear^.Y;
+tx:= HHGear^.X;
+ty:= HHGear^.Y;
 
 if ((Gear^.Message and gm_Down) <> 0) and (Gear^.Elasticity < Gear^.Friction) then
 	if not (TestCollisionXwithGear(HHGear, hwSign(ropeDx))
@@ -737,6 +737,9 @@
 HHGear^.X:= Gear^.X + cc*Gear^.Elasticity;
 HHGear^.Y:= Gear^.Y + cs*Gear^.Elasticity;
 
+HHGear^.dX:= HHGear^.X - tx;
+HHGear^.dY:= HHGear^.Y - ty;
+
 haveCollision:= false;
 if TestCollisionXwithGear(HHGear, hwSign(HHGear^.dX)) then
 	begin