Creating a simple simulation with gravity
In this recipe, we are going to configure a simple physics scene consisting of a single rigid body (a sphere) and the effects of gravity on it.
Load up PlayStation Mobile Studio and create a new project. Add references to
Sce.PlayStation.HighLevel.Physics2D. We also need to add a circular sprite; I used a picture of the earth aptly named
earth.png. The complete source and all images used can be found in
How to do it...
- Add the earth sprite to your project, and set its Build Action to Content.
- Open up the
AppMain.csfile and replace the existing code with the following code:
using System; usingSce.PlayStation.Core; usingSce.PlayStation.Core.Graphics; ...