by andy@andybeaulieu.com via Andy's Blog on 7/16/2009 12:21:00 AM
Today I released an initial version of “Physics Helper 3” to Codeplex. This includes a collection of new Behaviors for Expression Blend which makes it very quick to create physics games and simulations in Silverlight using the Farseer Physics Engine. This release requires Silverlight 3 and Expression Blend 3, which you can get here.DOWNLOAD PHYSICS HELPER 3
Demos
There are four new demos using Behaviors, plus the original demos depending on the older User Control model. Note that version 3 still supports the User Control model, but I would recommend checking out the new Behaviors model as there is nice design time support in Blend.VIEW ALL DEMOS
Getting Started Videos
I have a couple of quick (10 min) screen casts which show how to use the new Physics Behaviors:VIDEO ON "THE BASICS": VIEW | DOWNLOADVIDEO ON "JOINTS + PROGRAMMING": VIEW | DOWNLOAD
Enhancing Behaviors with Code
Behaviors are great, but I can't imagine creating a full game using only canned behaviors. So at some point, you will need to add code to do AI, control levels and game state, and other tasks. Here are some pointers to get started with that:
Once you drop a PhysicsController Behavior onto your main Canvas, you can later get a reference to that Physics Controller (the object that contains the simulation context) in code. Suppose your main Canvas is named "LayoutRoot" then you can get a reference as follows:
PhysicsControllerMain _physicsController = LayoutRoot.GetValue(PhysicsControllerMain.PhysicsControllerProperty) as PhysicsControllerMain;After you have a reference to the PhysicsController, you can modify any of the Farseer Physics Geometry or Body objects by getting a reference throught the PhysicsObjects dictionary:
_physicsController.PhysicsObjects["ball"].GeometryObject.RestitutionCoefficient = 1.3F;... and you can also get a reference to the oringal XAML UI Element using the uiElement property of the Physics Object:
Ellipse ball = _physicsController.PhysicsObjects["ball"].uiElement as Ellipse;ball.Fill = new SolidColorBrush(Colors.Red);
Feedback and Issues
This is an initial release and my first swing at Behaviors, so I'm sure there will be issues and suggestions. Please let them fly on the Codeplex Forum, and I hope you have fun!
Original Post: Physics Behaviors for Silverlight 3!
The content of the postings is owned by the respective author. Silverlight Feeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on Silverlight Feeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.