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 / Any reciple on basic values for 2D physics?

Author
Message
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 11th Apr 2021 22:49
I would think the first thing would be to set PhysicScale() to the right value, since everything is dependent on that. I have settled with setPhysicsScale(0.2) which to my understanding, should give me precision on the pixel level. (don't even remember how I got to that)
Still, I'm clueless about most of the values. I can't even figure out what the "right" mass would be. Could be 0.000001 or 1.0 or 100000. And since all those values are dependent on each other, I quickly end up jumping between them, hoping to find something that just works. One thing I figured out is that raising SetSpritePhysicsAngularDamping() can stop my sprite from being stuck in eternal spinning.

Are there any way to get those values to make sense, other than throwing random numbers at them and hoping that something sticks?
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 11th Apr 2021 23:25
Quote: "I can't even figure out what the "right" mass would be. "


weight/gravity = mass
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Apr 2021 00:11
The thing i found out was you need to have a very small virtual resolution in order to get any decent physics speed.
All my tests seemed to have the velocity top out when the virtual resolution was closer to the window size.
You can get the mass with GetSpritePhysicsMass() (There are quite a few physics functions)
basicFanatic
7
Years of Service
User Offline
Joined: 7th Jun 2017
Location:
Posted: 12th Apr 2021 11:22
I wrote a fancy dev function enabling me to edit the values in real time. No dice. The sprite still went totally batshit.

But then I finally figured out that ... I made a mistake. I had forgotten to normalize the rotation to something within the 0-360 range. Once fixed, everything just works.

Thanks for the help guys!

Login to post a reply

Server time is: 2024-11-24 02:19:46
Your offset time is: 2024-11-24 02:19:46