protected override void Invoke(object args) { if (_isControllerInitialized) { string body = this.AssociatedObject.Name; if (body == string.Empty) { throw new Exception("There is no Physics body for the given element. Be sure you added a PhysicsObjectBehavior to the element."); } PhysicsSprite sprite; if (!Controller.PhysicsObjects.TryGetValue(body, out sprite)) { return; } FarseerGames.FarseerPhysics.Dynamics.Body bodyObj = sprite.BodyObject; bodyObj.AngularVelocity = 0f; bodyObj.ClearTorque(); double newRotation = Controller.RadiansToDegrees(bodyObj.Rotation) + ((float)_angleValue); bodyObj.Rotation = (float)(Controller.DegreesToRadians(newRotation)); } }
bool OnSpringUpdated(Spring sender, FarseerGames.FarseerPhysics.Dynamics.Body body) { Update(); return(true); }