physics anomaly

This forum is currently in read-only mode.
From the Asset Store
Everything is made via physics, Very simple code: 6 events only (3 for tank creation, 2 for controls and 1 for camera)
  • hi guys.

    i was testing stuff with physics and i stumbled upon something that is puzzling me:

    when the physics object travels enough pixels, eventually the physics stop working. i made a simple .cap to illustrate the problem.

    http://dl.dropbox.com/u/11157144/physics%20anomaly.cap

    i know it has something to do with the setting world scale in physics object properties, but i'd like to know what exactly is causing this? why is this happening? what purpose does it serve? why does the physics object have to stop working when it crosses a certain distance? why are my pants inside out? <img src="smileys/smiley13.gif" border="0" align="middle">

  • It is a restriction by either the engine itself (box2D) or the implementation. From the Construct wiki:

    "Note: There is a maximum limitation of 20,000 x 20,000 on layout size with the physics behavior. If you go past this point with your object then physic behavior no longer works. "

    I assume it is a precision issue. Maybe box2D uses 32-bit data types, but whatever size one chooses for the data - there will be a limit. Because it is not the real world, but just a simulation... <img src="smileys/smiley1.gif" border="0" align="middle">

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • D'OH! i swear i took a quick look at the construct wiki, but somehow managed to miss that particular line. <img src="smileys/smiley9.gif" border="0" align="middle" />

    but thanks tulamide, now im a little wiser again, just have to keep that limitation in mind, so i dont go overboard with the layout size.

    anyway, cheers!

  • you can increase that range to whatever you want by changing the world x and y scale in the physics behavior to 0.001%

    or whatever size you want:

    2%=20,000x 20,000 1%= 40,000X40,000 0.1% 400,000x400,000 ext.

    you'll just have to adjust mass accordingly (original mass x 10, 100, 1,000 ext.)

  • you sir are a savior, many thanks.

    prior to reading your post I thought my almost 200 event cap was doomed due to this 20000px physics "problem".

    now i can laugh at my ignorance, instead of pull my hair out. I suppose reading some more tutorials might be a good idea too before adding another 200 events!

  • glad to help.

  • The latest version of box2d doesn't have this limit, and it's not a simple matter of linking the new library to make it work. Someone would have to redo alot of the code.   The world scale thing works, but if you don't scale your objects with the world, the physics simulation appears to be moving at a different speed.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)