Hello Guest

Author Topic: [Noob, please help] Gravity doesnt work with 1pix=1meter??  (Read 5148 times)

Lavaflyer

  • Newbie
  • *
  • Posts: 9
    • View Profile
[Noob, please help] Gravity doesnt work with 1pix=1meter??
« on: January 23, 2014, 01:11:17 am »
So I've been trying out the tile map tutorial (http://unikronsoftware.com/2dtoolkit/doc/2.10/tilemap/tutorial.html).  I'm new to 2d Toolkit and Unity for that matter but I am slightly confused with the gravity settings.  I've seen lots of posts on gravity being too slow because tk2d's camera scales all the sprites up massively resulting in slow gravity.  Many of the people answering the questions told them to go to edit< project settings< physics2d and scale the gravity to what you feel is appropriate.  This seemed to work for those people but no matter how high I put the Y value on gravity it doesn't seem to change too much (if at all, it's like it has hit a maximum).  I've also tried changing the gravity scale on the rigidbody2d component (to no avail).  Oh and by the way I've figured this may be part of the problem.  I've set the pixels per meter on the camera and sprite collection to 1.  I like this setting because it helps me when I'm in Photoshop and can make my assets the right size/size I want them, and I'm used to pixels from other programming languages so I was hoping to not have to change this setting.

Thanks,
Lavaflyer

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: [Noob, please help] Gravity doesnt work with 1pix=1meter??
« Reply #1 on: January 23, 2014, 11:17:53 am »
Just checked this and it looks like Unity is clamping the maximum velocity of an object somewhere in the 2D physics engine (increasing gravity works fine in the 3D physics engine), which means that the you won't be able to use 1 pixel per meter with 2d physics.

You could use 100 pixels per meter, you'll need to divide all your pixels by 100 - eg. 30, 60 becomes 0.3, 0.6.


eklavyaa

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: [Noob, please help] Gravity doesnt work with 1pix=1meter??
« Reply #2 on: July 19, 2014, 12:32:01 pm »
I have same problem with velocity , I have setting 1 pixel per meter for both Tile collection and Camera , No matter how much I increase velocity it don't get fast .
I am assigning velocity inside FixedUpdate , like transform.rigidbody2D.velocity= currentVelocity.  Is it the same issue as above should I use 100 pixel per meter for settings ?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: [Noob, please help] Gravity doesnt work with 1pix=1meter??
« Reply #3 on: July 19, 2014, 04:46:46 pm »
2D physics in unity is speed limited. If you want to use 2D physics, use 100 pixels per meter or somewhere around there.