[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Physics module status note, more things...



Nice reply Marcus!

> In order to get rid of that, you have to choose matching step times, sizes
> and the speed for bodies according to your simulation needs - at least as
> long as there is no CCD algorithm implemented :-).

Right.

> Simulated bouncing is implemented already. The collision energy, and how it
> is applied on the colliding bodies, depends on the restitution set for them.

All these fancy english words. :)

> Here's how I'd do it.
>
> * create a World with relatively high damping, the gravity vector points to
>   the top (e.g. world.gravity = 0, -3).
> * place body into that world with a certain damping, mass, etc.
> * have fun watching the simulation.

The wold would need more than just a size, it would need a position as well, 
but it'd be very difficult to do body transitions between the worlds anyway.
I think it'd be easier to change the behavior of a body that is inside 
another body.
Of course, the "fluid" body wouldn't be fluid, it would simply apply an 
force (opposite to gravity) based on the displaced mass, but that would be 
enough to simulate an ocean surface or pockets of contained fluids.
As I see it there would be three things to consider: the inverse of gravity, 
displaced mass and friction. I'm not sure about friction, because it would 
involve surface area calculations, but some "estimation" ;) of it will do.

I don't have a clue about the math involved to calculate the force, but I 
could give it a stab.

> Simulating a varying density of the world would require a slightly
> different approach for worlds. Currently the world does not know anything
> about its size and such, that however would be necessary, I think.

I still think doing it per body is easy enough and would have more use 
cases. It would be a rough estimation of water, but it'd work for what this 
library is intended to do, 

One final question: is it possible to lock joint rotation (no rotation)?

/Peter