Hello Guest

Author Topic: Gravity and Scene Scale  (Read 4309 times)

elsenior

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Gravity and Scene Scale
« on: August 23, 2012, 12:09:49 pm »
Hey,

I was just wondering about the relationship between scene/camera scale and gravity.

My game has a fixed background and a ground plane. On the ground plane there are wooden crates that can be moved around. When I pick up one of the crates and throw it in the it moves veeeeeery slowly with the standard gravity.

In order to get a velocity that seems right I have to set gravity to -1000, but I don't know if that's a good idea...?

How is that handled in a, let's say angry birds like, game?

Or am I doing something wrong here?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Gravity and Scene Scale
« Reply #1 on: August 25, 2012, 12:27:09 pm »
Hi elsenior,

The relationship is pretty much arbitrary. Unity units are arbitrary (but by default tuned to 1 unit = 1 meter, with gravity set to -9.81). First thing to do is work out how many Unity units is 1 meter with your scale, whatever the scale itself may be. Once you work out how many units is one meter, you can then scale everything else to compensate.

elsenior

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Gravity and Scene Scale
« Reply #2 on: August 25, 2012, 12:47:32 pm »
Well I have boxes in my game that are 64 pixels wide.

We could say that these boxes should be one meter in size. So 960 (screen width) / 64 = 15.

That means 15 pixels (or unity units) are one meter when my screen is 15 meters wide.

That's fine but how does that affect gravity? Still I have to set the gravity to -1000 to make it look good.

Or is it ok to have such a gravity value and I should just not care about the actual values too much?

Thanks

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Gravity and Scene Scale
« Reply #3 on: August 25, 2012, 01:10:29 pm »
At the end of the day, if it works, it doesn't really matter what it is :) I suspect you'd have had to make gravity 98 or something with default unity units. Is drag set too high somewhere?