Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411281 Posts in 69324 Topics- by 58380 Members - Latest Member: bob1029

March 28, 2024, 09:39:39 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Physics - Why No Bounce?
Pages: [1] 2
Print
Author Topic: Physics - Why No Bounce?  (Read 8743 times)
bateleur
Level 10
*****



View Profile
« on: March 06, 2008, 03:19:10 AM »

What with physics engines being oh-so-fashionable at the moment quite a lot of them are getting written and are appearing around the web.

Looking at the behaviour of various 2D engines, I noticed a puzzling pattern: nothing ever bounces!

If a cube (well OK, a square) drops onto a flat surface from a great height it remains in contact with the surface from the moment it first touches it. Whereas (depending on the materials involved) I'd expect it to bounce up into the air a bit.

Is there some terribly good reason why every single developer opts to lose all kinetic energy during collision, or are all these engines copying some well known implementation which happened to do things that way?

(Personally I don't like it. Bouncing is fun!)
Logged

kevglass
Level 1
*


View Profile WWW
« Reply #1 on: March 06, 2008, 03:24:21 AM »

Most 2D physics engines I've seen allow you to set the restitution factor on both of the elements coliding (or their materials) - this describes how bouncey something is going to be. Quite often the default value is set to zero though, so you get no resulting bounce.

http://en.wikipedia.org/wiki/Coefficient_of_restitution

Whether it's the proper term/use I don't really know.

Kev
Logged

Zaphos
Guest
« Reply #2 on: March 06, 2008, 03:54:49 AM »

Is there some terribly good reason why every single developer opts to lose all kinetic energy during collision, or are all these engines copying some well known implementation which happened to do things that way?
I think it's just that it's harder to predict behavior of bouncy objects, so it's easier to do the game design if objects can't bounce.  Like kevglass said, it should be easy to make objects bouncy from a technical standpoint.
Logged
ravuya
Level 7
**


Yip yip yip yip yip


View Profile WWW
« Reply #3 on: March 06, 2008, 07:05:55 AM »

Bounciness probably also doesn't help much with limiting instability, you'd probably get an appreciable amount of twitchiness if you didn't cut it off at some threshold.
Logged

bateleur
Level 10
*****



View Profile
« Reply #4 on: March 06, 2008, 07:09:52 AM »

All good points, thanks.

From my perspective it's a bizarre default choice because it makes the engine look bad. And I'm inclined to think bounce is good for gameplay...

...could be time to go and play with ideas! Smiley
Logged

deadeye
First Manbaby Home
Level 10
*



View Profile
« Reply #5 on: March 06, 2008, 08:39:16 AM »


From my perspective it's a bizarre default choice because it makes the engine look bad. And I'm inclined to think bounce is good for gameplay...


Not for platformers.  I've tried making a few platform engines with Construct's physics engine and the bounciness is just problematic.  It's impossible to get decent response to jumping when your guy can't land on the ground solidly.
Logged

tweet tweet @j_younger
Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #6 on: March 06, 2008, 08:50:39 AM »

Not for platformers.  I've tried making a few platform engines with Construct's physics engine and the bounciness is just problematic.  It's impossible to get decent response to jumping when your guy can't land on the ground solidly.

characters doesn't need to bounce, 'cause it's like your guy erase the force falling on the legs. I bet that if you jump you will not bounce too (I hope)
Logged

<Powergloved_Andy> I once fapped to Dora the Explorer
ninjascience
Level 0
***



View Profile
« Reply #7 on: March 06, 2008, 09:20:39 AM »

I tried making a tank game in Flash usign an AS3 port of Box2D.  My partner and I had the wheels and treads all modeled in the physics engine.  It was very cool, driving that tank around with it's realistically moving treads, but the more we worked with it, the more we realized it was too "real".  We didn't have the processing power to model teeth on our wheels so the treads sometime slipped.  If the tank really got going fast and hit a small object the treads would fly off, or the object would get stuck inside the treads.  Tipping over while going over drops was a big problem too.  In the end I decided to drop the advanced physics.
Logged
Eclipse
Level 10
*****


0xDEADC0DE


View Profile WWW
« Reply #8 on: March 06, 2008, 10:07:53 AM »

I tried making a tank game in Flash usign an AS3 port of Box2D.  My partner and I had the wheels and treads all modeled in the physics engine.  It was very cool, driving that tank around with it's realistically moving treads, but the more we worked with it, the more we realized it was too "real".  We didn't have the processing power to model teeth on our wheels so the treads sometime slipped.  If the tank really got going fast and hit a small object the treads would fly off, or the object would get stuck inside the treads.  Tipping over while going over drops was a big problem too.  In the end I decided to drop the advanced physics.

you hadn't to model teeth on weels, physics in game is done via simplifications, you had to set your wheels an higher friction and an higher gravity Smiley have a realistic physic is all in tweaking
Logged

<Powergloved_Andy> I once fapped to Dora the Explorer
ninjascience
Level 0
***



View Profile
« Reply #9 on: March 06, 2008, 11:27:17 AM »

yep, we set the friction up REALLY high on the wheels, but there was still some instances of slippage.  And that was only one of numerous problems.
Logged
bateleur
Level 10
*****



View Profile
« Reply #10 on: March 06, 2008, 11:30:00 AM »

we realized it was too "real" [...] the tank really got going fast and hit a small object the treads would fly off

Because real tanks have this problem all the time. In my experience, at least. Wink
Logged

Wilson Saunders
Level 5
*****


Nobody suspects the hamster


View Profile WWW
« Reply #11 on: March 06, 2008, 12:10:49 PM »

It is easier to set velocity to 0 when a collision occurs than to calculate angle of reflection and dampening.

Secondly "more realistic" does not always translate to better game play. Would Mario be more fun if it accurately simulated jumping on turtles? It is up to the individual game designer to decide what aspects of reality they want to incorporate into their game. Most of the time "bouncing" is not realy that important and is omitted.
« Last Edit: March 06, 2008, 12:21:24 PM by hamster » Logged

Play my games at http://monkeydev.com/
Zaphos
Guest
« Reply #12 on: March 06, 2008, 01:02:31 PM »

It is easier to set velocity to 0 when a collision occurs than to calculate angle of reflection and dampening.
Usually you don't want to actually set velocity to 0; you want to set it to 0 along the axis perpendicular to the collision surface.  This requires about the same amount of math as reflection.

Also I wouldn't explicitly calculate an angle; generally it's easier to just dot your velocity with the unit surface normal, scale the unit normal by that value, then subtract the result from your velocity.
Or use something like Box2D, where restitution is just a parameter you can set.
Logged
kevglass
Level 1
*


View Profile WWW
« Reply #13 on: March 06, 2008, 01:15:05 PM »

A java port of Box 2D Lite is what I'm using. Slight bounce doesn't seem to hurt playability in a platformer (albiet mine is driving trucks around platforms).

Kev
Logged

Zaphos
Guest
« Reply #14 on: March 06, 2008, 01:28:15 PM »

A java port of Box 2D Lite is what I'm using. Slight bounce doesn't seem to hurt playability in a platformer (albiet mine is driving trucks around platforms).
Do your trucks jump?  (Just curious!)

I do think it depends at lot on the specifics of the game.
Logged
kevglass
Level 1
*


View Profile WWW
« Reply #15 on: March 06, 2008, 01:36:11 PM »

Heh, believe it or not, my trucks jump Smiley - it's way more fun that way!

Kev
Logged

raigan
Level 5
*****


View Profile
« Reply #16 on: March 06, 2008, 01:55:03 PM »

one reason demos might not show any bouncing is that bouncing is an easy behaviour -- it's easier to make things bounce than to avoid bouncing/jitter. also, resting contact is one of the harder problems, and having all the objects bounce is a simple way to avoid having to deal with it properly -- so, lack of bouncing could be in order to demonstrate how well resting contact works.

Logged
deadeye
First Manbaby Home
Level 10
*



View Profile
« Reply #17 on: March 06, 2008, 04:06:09 PM »

Heh, believe it or not, my trucks jump Smiley - it's way more fun that way!

Do they jump by adding force upwards or by pushing the wheels downwards and bouncing off the ground?  If you push your wheels downwards then I can see that it wouldn't be a problem.  Whereas jumping by adding force upwards looks weird unless you are in stable contact with the ground... which is problematic if the object jumping is bouncing around instead of absorbing the shock of impact.
Logged

tweet tweet @j_younger
kevglass
Level 1
*


View Profile WWW
« Reply #18 on: March 06, 2008, 04:38:00 PM »

They jump at the moment by adding force upwards. However, thats only allowed while they're actually touching the ground (it's a bit of a wierd one given trucks arn't generally in the habit of jumping). So, the *slight* bounce when the truck lands makes it feel more natural - think the fall guy truck driving, it lands, smashing up the suspension, little hop and then drives off - the bouncing doesn't last long enough to stop you jumping again pdq.

Kev
Logged

deadeye
First Manbaby Home
Level 10
*



View Profile
« Reply #19 on: March 06, 2008, 05:54:23 PM »

They jump at the moment by adding force upwards. However, thats only allowed while they're actually touching the ground (it's a bit of a wierd one given trucks arn't generally in the habit of jumping). So, the *slight* bounce when the truck lands makes it feel more natural - think the fall guy truck driving, it lands, smashing up the suspension, little hop and then drives off - the bouncing doesn't last long enough to stop you jumping again pdq.

I guess having a truck bounce makes sense in that context.  More so than a person jumping.

On an unrelated note, why do you keep signing your posts?  Your user name is like, right there on the right already.

Signed,

Sir Dr. Mahatma Beaufort Algonquin III, P.H.D., Esq. DBA Tangenital Investments, LLC
« Last Edit: March 06, 2008, 05:57:32 PM by deadeye » Logged

tweet tweet @j_younger
Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic