Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [BUG] Specific physics settings on a sprite with specific image crash AGK Player (on OSX)

Author
Message
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 15th Mar 2017 14:38
Here is the (minimized) project code:



To reproduce:
-In AppGameKit editor, create new project
-Paste above code in the project main.agc. You do not need a loop or anything else because the last statement crashes the program.
-Put the attached bone.png in the project media folder
-Run the project
-Observe AppGameKit Player crash

Some notes:
-Only tried it on OSX.
-I tried to email someone at TGC about this (to avoid attaching my awesome assets here of course) but I guess they could not reproduce. Maybe it is OS specific or something, maybe someone else can try as well.
-This has happened to me at least with two sprites of different sizes with different images but with these same physics parameters (the crash at SetPhysicsMass)
-Changing the mass to 5 caused the crash to go away. Changing the scale to 0.05 also cause it to go away. So I guess it has something to do with specific parameter combinations.
-I have many sprites with different images that do not have this issue, even with these physics parameters, so you also need some specific attributes for the sprite. The bone image I attached always "works" for me.

Attachments

Login to view attachments
Richard_6
7
Years of Service
User Offline
Joined: 3rd Feb 2017
Location:
Posted: 16th Mar 2017 03:27
Hi tmu, try this:



I tested on OSX and worked well.
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 16th Mar 2017 17:05
Thanks Richard. Do those physics parameters give a similar configuration?

I actually managed to get around this by disabling the call to setting mass. But hopefully the crash could be fixed, since debugging what causes it is sometimes difficult when you get no indication what went wrong, just a crashed player every time the game is run.. and when mass is actually needed the crash would be a blocker..
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 17th Mar 2017 16:52
Thanks, fixed for the next version. Although I would recommend using a larger physics scale and adjusting the physics parameters accordingly as this was caused by floating point rounding errors when using a very small scale.
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 18th Mar 2017 15:31
Thanks.

I don't have much experience or in-depth understanding of the physics parameters, so I was just happy to find some combination that worked like I wanted . With scale, gravity, et al.

I guess I need to experiment a bit more to try to figure out what gives a nice dropping speed etc. Tried to Google for box2d physics parameters etc. but it often gets a bit too detailed for me.

Login to post a reply

Server time is: 2024-11-24 18:50:43
Your offset time is: 2024-11-24 18:50:43