Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411792 Posts in 69413 Topics- by 58459 Members - Latest Member: DANDAN1

May 27, 2024, 11:01:53 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Faking box physics with ball physics?
Pages: [1]
Print
Author Topic: Faking box physics with ball physics?  (Read 1992 times)
Glaiel-Gamer
Guest
« on: May 11, 2009, 10:56:33 AM »

I managed to hack ball physics into new closure recently and fairly simply using a bitmap collision kinda thing, ball physics is so easy!

Originally I was planning on trying to hack the behavior into Box2D with by writing some shoddy bitmap shape hack, but the hack itself might be more trouble than its worth.

Speed isn't that big of a deal, the most shapes I plan to have interacting with each other on a given stage is a couple at most. It's not a physics game at heart so naturally they're just there to supplement the experience.

I was thinking about faking box (square) physics using balls. I don't know how well that would work, and I can think of more troubles than I can think of advantages, but it definitely got me thinking a little bit.

My other option was treating it as a set of points instead then adding restraints among them, since point - bitmap physics is easy enough. Looks more like this will be the better way, and I might end up trying the box2D hack in the end after all.
« Last Edit: May 12, 2009, 06:56:59 PM by Derek » Logged
Ivan
Owl Country
Level 10
*


alright, let's see what we can see


View Profile
« Reply #1 on: May 11, 2009, 11:28:45 AM »

Wait, I don't understand... What exactly is it that you need to hack into Box2D??
Logged

http://polycode.org/ - Free, cross-platform, open-source engine.
Glaiel-Gamer
Guest
« Reply #2 on: May 11, 2009, 11:34:35 AM »

Wait, I don't understand... What exactly is it that you need to hack into Box2D??

Bitmap land. My engine is an ever changing bitmap shape if you ever played the original, it was the best possible way to implement it.
Logged
Impossible
Level 3
***



View Profile
« Reply #3 on: May 11, 2009, 02:04:18 PM »

Looks like it is difficult to implement a bitmap shape for Box2D.  You'll never get a ball behaving like a box Smiley, but its not too hard to implement basic 2D rigid body dynamics for boxes (without stacking or constraints...) Chris Heckers articles might be helpful.  Another alternative would be to implement Jacobsen verlet physics.
Logged
BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #4 on: May 11, 2009, 02:15:45 PM »

I was thinking verlet, too. It's astoundingly easy to implement.
But I still think by the time you've cleared the glitches out, it would be equivalent work to adding on to an engine. The actual physical reaction to the collision, and determining the geometric properties of the collision are more or less orthogonal, so you might as well outsource as much of the first as you can. Some physics methods require less geometric information than other, so I suppose that should be your main criteria.
Logged
bateleur
Level 10
*****



View Profile
« Reply #5 on: May 12, 2009, 05:23:01 AM »

The biggest problem with modifying Box2D is that you'll get some very weird (and likely unwanted) side effects when the terrain changes shape. Box2D is typically run in timesteps much smaller than a full video frame. If in a single Box2D cycle a new shape appears from nowhere (or an existing one deforms significantly) this could give a pretty hefty kick to anything that ends up overlapping it.

Having played (and very much enjoyed) the original Closure, I'm a bit concerned that this could end up introducing the equivalent of Doom's "rocket jumps". Sad
Logged

BorisTheBrave
Level 10
*****


View Profile WWW
« Reply #6 on: May 12, 2009, 11:35:00 AM »

Bateleur: Box2D separates position and velocity solutions (nowadays). Meaning if you create two things overlapping they will separate at great speed, but it won't affect their actual velocity after they cease overlapping.
Logged
Zaphos
Guest
« Reply #7 on: May 12, 2009, 11:53:00 AM »

Looks like it is difficult to implement a bitmap shape for Box2D.  You'll never get a ball behaving like a box Smiley, but its not too hard to implement basic 2D rigid body dynamics for boxes (without stacking or constraints...) Chris Heckers articles might be helpful.  Another alternative would be to implement Jacobsen verlet physics.
If you implement rigid bodies without stacking or constraints, following chris hecker's stuff, wouldn't that be quite jittery?  His examples are, at least.  I think you'd need some better treatment of contact forces, which is more annoying to implement.
Logged
Impossible
Level 3
***



View Profile
« Reply #8 on: May 12, 2009, 07:53:38 PM »

If you implement rigid bodies without stacking or constraints, following chris hecker's stuff, wouldn't that be quite jittery?  His examples are, at least.  I think you'd need some better treatment of contact forces, which is more annoying to implement.

Putting bodies that aren't moving that much to sleep or having heaving dampening would improve the behavior somewhat. Penalty constraints might not be that hard to implement. When it gets to the point where he's basically rewriting box 2D he might as well just bite the bullet and implement a bitmap collision shape...
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic