Hello Guest

Author Topic: Floaty physics?  (Read 6632 times)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9567
    • View Profile
Floaty physics?
« on: May 26, 2013, 12:25:11 AM »
Setting up physics.

Physics is configured in the Unity Physics Manager.
http://docs.unity3d.com/Documentation/Components/class-PhysicsManager.html

You will likely need to adjust physics to work well with your scene/sprites based on your camera. Here is a quick way to help pick appropriate gravity settings. There is no magic number which will work in all cases - it depends very much on what your sprites represent.

1. Work out the screen height in meters from the top to the bottom of your game window screen. Eg. if you can stack up 10x 1 meter boxes to fill up your screen vertically, then thats 10 meters.

2. Work out the camera height - if you're using an orthographic camera, it will be the orthographic size * 2. If you use a tk2dCamera, it will be the height of your native resolution in pixels.

gravity.y should be around = -9.81 * camera height / screen height meters for things to fall naturally.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9567
    • View Profile
Re: Floaty physics?
« Reply #1 on: May 26, 2013, 07:04:09 PM »
Note: If you experience bad collisions when using the tk2dCamera - it usually means the colliders aren't thick enough. Open up the sprite collection editor, and in settings increase physics depth to make the shapes more uniform, about 50 works well.