I'm trying to use Chipmunk2D for a simple physics simulation involving pendula. I've set up a simple preliminary scenario with a mass hanging straight below a fixed point, attached by a pin joint. The mass is hit with an impulse to the left as soon as the simulation starts, and nothing else is actively done to the mass.
However, it appears that energy dissipation is occuring somewhere in Chipmunk's calculuations, as the pendulum will eventually lose velocity and the maximum angle it achieves will decrease. While this is realistic, it's not the behaviour that I want. Is there a way that I can get Chimpunk to simulate objects whithout any energy dissipation due to friction, air resistance, etc?
Energy Dissipation in Pendulum
-
- Posts: 3
- Joined: Sun Nov 17, 2013 11:04 am
- Contact:
-
- Posts: 29
- Joined: Wed May 09, 2012 12:06 am
- Contact:
Re: Energy Dissipation in Pendulum
It sounds like you may have a custom damping or gravity value set on the space. Neither are set by default. Try checking for calls to cpSpaceSetDamping and cpSpaceSetGravity.
-
- Posts: 3
- Joined: Sun Nov 17, 2013 11:04 am
- Contact:
Re: Energy Dissipation in Pendulum
I have set a custom gravity value, but that's intended. I'm modelling a pendulum, and need gravity to act as a conservative force on the system. However, even removing the gravity from the system, things slow down. Any ideas? Can I provide more information that would help?
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Energy Dissipation in Pendulum
While it's not specifically desired behavior, it is expected behavior even given perfect initial conditions.
Chipmunk like pretty much all other physics engines intended for games are tuned for performance and not exactness. They tend to use Euler integration because it has some very desirable behaviors for simulations. They tend to use inaccurate iterative based solvers since they allow you to pick a compromise between accuracy and performance. They use discrete time steps since analytic solutions to even simple problems with few objects tend to quickly turn into a mess.
So. If you are really looking for a super accurate simulation you probably need to integrate and simulate it yourself.
Chipmunk like pretty much all other physics engines intended for games are tuned for performance and not exactness. They tend to use Euler integration because it has some very desirable behaviors for simulations. They tend to use inaccurate iterative based solvers since they allow you to pick a compromise between accuracy and performance. They use discrete time steps since analytic solutions to even simple problems with few objects tend to quickly turn into a mess.
So. If you are really looking for a super accurate simulation you probably need to integrate and simulate it yourself.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 3
- Joined: Sun Nov 17, 2013 11:04 am
- Contact:
Re: Energy Dissipation in Pendulum
Fair enough, that makes quite a bit of sense. I'll see what I can do simulating myself, or maybe I can arrange my constraints so that Chipmunk will satisfy. Either way, Chipmunk is certainly a useful library!
Who is online
Users browsing this forum: No registered users and 10 guests