Centrifugal and gravity?

Hi guys, I would like to know two things that interest me for a project about the integrated physics engine:

the first is whether the Panda3D Physics Engine support the centrifugal force;

the second is whether the force of gravity managed by the engine is calculated based on the masses interaction of objects or only on the gravitational acceleration number.

Thanks all

Panda’s integrated physics engine is very rudimentary and doesn’t include these kinds of realistic physics concepts. If this is important to you, you should consider using one of the third-party physics engines that have been integrated with Panda.


I think the integrated physics engine can do gravity quite well, by using a LinearSinkForce (if we are talking about the radial gravity field of e.g. a planet) or LinearVectorForce (if we are talking about gravity on the surface of a planet).

A centrifugal force is no “real” force, but a fictional force observed in rotation reference systems. Hence it is supported by all physics engines out of the box: just “observe” your scene from a rotating frame, i. e. rotate the camera around like it was mounted on some object which rotates - that’s all.

A lengthy discussion of centripetal force and coriolis force including a Bullet sample can be found here: [centripetal / centrifugal forces, how could it be done?)

If you don’t want to do it the realistic way and observe from a rotating frame you can cheat: PhysX offers forcefield classes, and the built-in physics engine offer the LinearSourceForce and LinearSinkForce classes which could be used to fake centrifugal forces (or gravity)

Finally about how forces are computed: non of the (game) physics engines computes forces (direction and magnitude) from any physical interaction, be it gravity, electromagnetic or strong force. It is the developers duty to choose reasonable computations - which are rarely realistic. Realistic means no fun in games!

thanks enn0x, you are right.

I simulate it in 3dsmax with physx plugin and it work right when i joint an object to another, apply a gravity plane to both and spin the central object in one direction (The other object lift off automatically :smiley:)

But i ask you if default physic engine of panda3d can manage spherical gravity like a planet?

Thanks again

I think that the Panda3D class LinearSinkForce should do the trick.

Sorry again enn0x, but LinearSinkForce is a trick or a simulation?
I’m interested in simulation systems.

Huh? Neither. LinearSinkForce is a class which is part of the Panda3D internal physics system. The class creates an attractive force. You can set the center of the attractive force and the fallof type (e.g. FTONEOVERR) and scale ®.

For detailed documentation look at the API reference ( panda3d.org/reference/devel/ … kForce.php ).

For how to use forces with the Panda3D internal physics system refer to the manual.

Sorry again Enn0x, but can you tell me which are the pro and con between panda3d physic engine, Ode engine and Bullet engine?

thanks a lot

“But i ask you if default physic engine of panda3d can manage spherical gravity like a planet?”

Panda3d’s LinearSinkForce, from recent experimenting, doesn’t seem to work for simulating spherical world gravity. I could only get it to create a “bowl” shaped force, meaning that the force got stronger as objects moved away from the center point of the force, which is the opposite of a gravity “well”.

As for the Bullet and Ode systems, neither seemed to offer anything but planar gravity (i.e. all in one direction), which obviously doesn’t work for simulating spherical world gravity.

In the end it’s not that hard to simulate these forces using your own code and then apply updates to model positions every frame. If you’re just making a fun game then this might be overkill, but if you’re making any kind of realistic simulation (i.e. solar system) then writing your own routines would give you much more control anyways; you could decide whether to factor in masses or just use G. A simple Euler integrator can do gravity reasonably well as long as the speed of the simulation isn’t too fast.

Thanks Cslos77.
I’m like to know if exist a physic engine source write in c++ that simulate planets gravity well (with collision viscosity and joints) and can be implemented in panda3d quite easily.

Have you looked through these?

I don’t know how well any might suit your purposes or how easily they might be integrated with Panda, but that page might be worth a look.

Otherwise, it might be worth either trying to implement gravitation on your own, as cslos77 suggests, re-evaluate your game’s requirements or consider a new game engine.

Is it possible that you made a mistake when setting up the fallof? Because for me the code looks fine. If you think you have done everything right then you should report this as a bug, and including a short example. Then we could fix it.

enn0x: I wasn’t sure whether or not the result I was getting was the intended outcome of the force or not. A bowl shaped attractor, while not useful for gravity, could be useful for many other things.

Was this force intended to recreate a spherical gravity well? I experimented with numerous different combinations of amplitude, radius, and falloff type but could only get a bowl shape to emerge. If this not the intended behaviour then I can post a bug report with a demo if you want.

I don’t know what the original intention of this class has been, but the class documentation is non-ambigious. It says “Attractor force. Think black hole.”. And I look at the source code which computed the force, and it seems to be the correct implementation of a 1-over-r for field, i. e. gravity. Yes, a sample would be fine.