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 / Physics - Is there a limit to the amount of 'force' which can be applied? [AGK V1]

Author
Message
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 2nd Jan 2014 23:03 Edited at: 2nd Jan 2014 23:04
I think the short answer is going to be 'Yes'... For my platform game the character is very 'floaty' when jumping. To overcome this, I can set the gravity really high and increase the force (Velocity) when jumping. The problem is that there appears to be a limit to the amount of velocity you can apply. Here is a basic example (requires no media) which illustrates my issue;



As you can see, I apply different levels of force, yet the last 3 boxes all reach the same height... Does anyone know a way around this? I have tried messing with Physics Scale and Sprite Mass all to no avail... Reducing the Gravity will of course help, but this also increases the floaty-ness (for want of a better word ) which is what I am trying to avoid.

Thanks!
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 3rd Jan 2014 05:03
Well, as I have discovered, the Mass, Gravity and PhysicsVelocity have a definite relationship.

I found, the hard way, that the Physics Gravity (SetPhysicsGravity) makes a big difference.

I ended up setting the gravity to 0.02f in order to see the same time based performance on devices with FPS ranging from 15 to 60.

The Force and Velocity behave a bit differently (but both respond to what the gravity and mass are).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 3rd Jan 2014 08:46
setPhysicsScale makes an even larger difference. Set the scale before you do ANY other physics code and you'll see a huge difference in what forces do to a sprite.

oct(31) = dec(25)
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 3rd Jan 2014 12:32
The problem I have, is that to get the desired look and feel, I have to set the Gravity really high (1000). This looks great and is exactly how I want it to behave, but this also means there is a limit to the amount of Velocity I can apply (about 700) which doesn't give me enough force (anything more than 700 behaves exactly the same)... I have tried messing with the Sprite mass which didn't appear to make a difference, and Physics Scale changes everything (including Gravity) so changes the feel again.

In a nutshell, I'd like to be able to apply >700 velocity with the Gravity set to 1000, but I don't believe this is possible as there must be some kind of limit...

I think I'll try using the physics to create my own gravity by applying a constant downwards impulse force to my character. Maybe that will give me the desired look/feel??

Thanks to both of you for your reply...
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 3rd Jan 2014 14:55
Unfortunately I think you need to start again, as per Baxslash's advice about physics scale. Once that has been set to be close to what you want, you can adjust everything else around it.

I would be tempted to set up a quick system to adjust your settings in-game, and when you're happy save them.

Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 3rd Jan 2014 17:21
I think you are quite right BatVink... I will experiment more with the Physics scale. Thanks...
Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Jan 2014 20:42
I like 0.17 as a physics scale, seems to make a 1024x768 environment nice and responsive.

One other thing, have you considered adding your own gravity?

I found it was the only way to get my balloons to behave anything like realistically... I'm actually doing quite a few adjustments, like the angle velocity to encourage them to stay upright, as well as adjusting the velocity on each sprite. It's not ideal, but sometimes it's good to take more control over Box2D, encourage sprites to behave how you want them to, and bring some order

I am the one who knocks...
Funnell7
12
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 7th Jan 2014 12:27 Edited at: 7th Jan 2014 12:27
Yeah, I did consider creating my own gravity for the character sprite only, but before doing so, I wanted to ensure I had tried all other avenues first...

I've been missing about with just about every physics command there is and have finally got it to a point where I am really happy. The main two parameters being Physics Scale (I settled with 0.05) and the Gravity (1000). This gives me pretty much exactly what I was looking for (no 'floaty-ness')...

Thanks for the reply

Login to post a reply

Server time is: 2024-05-03 02:46:59
Your offset time is: 2024-05-03 02:46:59