From 69b0cca1d10513129c173675df4d1fcbd43f6518 Mon Sep 17 00:00:00 2001 From: CommonSenseLies Date: Fri, 24 Apr 2015 19:28:11 -0400 Subject: [PATCH] Simplified the PhysicsBody code --- .../GoneBananasShared/CCPhysicsSprite.cs | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/GoneBananas/GoneBananasShared/CCPhysicsSprite.cs b/GoneBananas/GoneBananasShared/CCPhysicsSprite.cs index de0649d..8c34bfa 100644 --- a/GoneBananas/GoneBananasShared/CCPhysicsSprite.cs +++ b/GoneBananas/GoneBananasShared/CCPhysicsSprite.cs @@ -20,29 +20,12 @@ public void UpdateBallTransform() { if (PhysicsBody != null) { - b2Vec2 pos = PhysicsBody.Position; + b2Vec2 pos = PhysicsBody.Position; - float x = pos.x * ptmRatio; - float y = pos.y * ptmRatio; + float x = pos.x * ptmRatio; + float y = pos.y * ptmRatio; - if (IgnoreAnchorPointForPosition) - { - x += AnchorPointInPoints.X; - y += AnchorPointInPoints.Y; - } - - // Make matrix - float radians = PhysicsBody.Angle; - var c = (float)Math.Cos (radians); - var s = (float)Math.Sin (radians); - - if (!AnchorPointInPoints.Equals (CCPoint.Zero)) - { - x += c * -AnchorPointInPoints.X + -s * -AnchorPointInPoints.Y; - y += s * -AnchorPointInPoints.X + c * -AnchorPointInPoints.Y; - } - - Position = new CCPoint(x, y); + this.Rotation = -1 * PhysicsLayer.RADTODEG * PhysicsBody.Angle; } } }