2D Toolkit Forum

2D Toolkit => Support => Topic started by: elsenior on August 23, 2012, 12:09:49 pm

Title: Gravity and Scene Scale
Post by: elsenior 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?
Title: Re: Gravity and Scene Scale
Post by: unikronsoftware 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.
Title: Re: Gravity and Scene Scale
Post by: elsenior 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
Title: Re: Gravity and Scene Scale
Post by: unikronsoftware 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?