physics anomaly

For questions about using Classic.

Post » Thu Mar 29, 2012 1:28 pm

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?

B
1
Posts: 7
Reputation: 239

Post » Thu Mar 29, 2012 2:57 pm

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...
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Mar 29, 2012 4:20 pm

D'OH! i swear i took a quick look at the construct wiki, but somehow managed to miss that particular line.
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!
B
1
Posts: 7
Reputation: 239

Post » Mon Apr 02, 2012 4:21 pm

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.)
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

Post » Wed Apr 11, 2012 4:47 pm

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!
B
8
S
3
G
3
Posts: 3
Reputation: 2,440

Post » Wed Apr 11, 2012 8:10 pm

glad to help.

Bartosh2012-04-11 20:10:47
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

Post » Wed Apr 11, 2012 9:44 pm

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.
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests