Physics seems to work weaker on real android device.

So I made a game. Very excitedly built for android and got it into a real android device. App works fine except physics… Gravity pull is weaker and setLinearVelocity is slower too. I tested if it’s really physics working slow by creating two display objects, one physics body and the other normal one, and made them move at approximately the same speed by using setLinearVelocity for physics object and the other using transition.to. The transition.to works just as seen on my simulator while physical body’s movement was slower. What’s wrong. Any kindness is appreciated  :slight_smile:

Is the device the same resolution as the simulated device you tested on?

This is more likely a case of you not handling scaling correctly.  If you don’t handle this right, it will seem like things move faster or slower on different devices.

There are other things you may be doing wrong here.  

I suggest you do this.

  1. Make a tiny project (build.settings, config.lua, main.lua, some art assets if needed).

  2. In this project demonstrate a physics interaction like a bouncing ball and/or an object moving using physics forces.

  3. Simulate it.

  4. Install it on your device.

  5. Compare the behavior.

  6. If they seem different to you, zip up the project and share it here.

Do not share your current game with us.  That will be too much work to review.  A tiny project is more manageable for folks to give help on.

Be aware, I have a ton of examples here https://github.com/roaminggamer/RG_FreeStuff

See the ‘AskEd’ folder, which contains over 400 code examples I have made over time in answer to various questions here in the forums.

Here is a particular example you can run on the simulator then on your device:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/04/shooterMechanics.zip

It scales correctly and will behave the same on all devices and in the simulator (assuming your don’t have a really old or slow device.)

Tap screen to fire.

The only files you need to look at are:

  • main.lua
  • scripts/ex1.lua

https://www.youtube.com/watch?v=llV2NdQh9Ls

If you’ve tweaked physics.setScale or physics.setTimeStep(), your problem may be there. I, however, second @roaminggamer’s advice.

Whenever I have a weird issue that I can’t figure out, 99% of the time I find the solution when I am preparing a small sample project to share on the forums. Isolating the problem area and focusing solely on it without all of the extra bits and code works wonders.

 

Is the device the same resolution as the simulated device you tested on?

This is more likely a case of you not handling scaling correctly.  If you don’t handle this right, it will seem like things move faster or slower on different devices.

There are other things you may be doing wrong here.  

I suggest you do this.

  1. Make a tiny project (build.settings, config.lua, main.lua, some art assets if needed).

  2. In this project demonstrate a physics interaction like a bouncing ball and/or an object moving using physics forces.

  3. Simulate it.

  4. Install it on your device.

  5. Compare the behavior.

  6. If they seem different to you, zip up the project and share it here.

Do not share your current game with us.  That will be too much work to review.  A tiny project is more manageable for folks to give help on.

Be aware, I have a ton of examples here https://github.com/roaminggamer/RG_FreeStuff

See the ‘AskEd’ folder, which contains over 400 code examples I have made over time in answer to various questions here in the forums.

Here is a particular example you can run on the simulator then on your device:

https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2018/04/shooterMechanics.zip

It scales correctly and will behave the same on all devices and in the simulator (assuming your don’t have a really old or slow device.)

Tap screen to fire.

The only files you need to look at are:

  • main.lua
  • scripts/ex1.lua

https://www.youtube.com/watch?v=llV2NdQh9Ls

If you’ve tweaked physics.setScale or physics.setTimeStep(), your problem may be there. I, however, second @roaminggamer’s advice.

Whenever I have a weird issue that I can’t figure out, 99% of the time I find the solution when I am preparing a small sample project to share on the forums. Isolating the problem area and focusing solely on it without all of the extra bits and code works wonders.