New Animation

Official forum for the Chipmunk2D Physics Library.
Post Reply
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

New Animation

Post by slembcke »

Not that it's of particularly great interest to most people in general, but I finally made a new animation. Hadn't done that in a while, so that was fun.

http://youtube.com/watch?v=sTHoWaTNJiA
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
lucas
Posts: 54
Joined: Wed Sep 26, 2007 2:34 am
Contact:

Re: New Animation

Post by lucas »

Awesome!
How did you:
-Have the thing spin continuously at the beginning?
-Make the lines snap back into place? (was it dampened spring?)
-Have the balls bounce alot when they hit that line, even though they barely bounced at other times.
Tangame - a tangram puzzle game with physics.
http://code.google.com/p/tangame/
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: New Animation

Post by slembcke »

Good questions:
  • The spinning bit is an infinite mass/moment body that I simulate outside of cpSpaceStep(). I set it's rotational velocity, and just call cpBodyUpdatePosition() after the call to cpSpaceStep().
  • All the tipping parts just have a pivot joint that is offset from the center of gravity. They also have slide joints attached that limit their rotation.
  • The "bounce line" is attached to an infinite mass/moment body with a large upward velocity that is not otherwise simulated. When solving the collision, the effect is that the ball is hit by a heavy, fast moving object. Think of it like a pinball bumper.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
citrys
Posts: 16
Joined: Thu Nov 15, 2007 12:26 am
Contact:

Re: New Animation

Post by citrys »

Ingenious. How exactly are the elements composed? For example, the teeter-totter that filters balls left or right; is that three separate shapes? What's the second body to which it's pinned, just a tiny invisible non-simulated infinite? How is the slide joint set up to limit rotational motion?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: New Animation

Post by slembcke »

I define a single static body that I use globally throughout the scene. Same thing that I do in other demos to attach the static scene geometry to. This static body is what I attach the "other" end of the joints to.

As far as how I constructed the different mechanical pieces:
  • The teeter toter in the middle is just two segment shapes attached to the same body. It has a pivot joint below it's center of gravity so that it tips.
  • The flaps on the left side were made by attaching a joint above the center of gravity of a body and extending a segment shape away from the pivot. Think of it as an L bracket with a heavy weight hanging on it. You just can't see the bottom part.
  • The tipping part on the right has it's center of gravity in the corner where the two segment shapes meet. The pivot attaches to the right of this so it tips to the left. It's much heavier than the balls, so it takes a number of balls to tip it.
  • All of the parts have a slide joint attached away from the pivot point to limit their rotation. Think of it as connecting a chain to them. They can only rotate so far in either direction away from the chain's anchor point.
I suppose I should change my demo drawing code to draw the rigid bodies and joints. It would make the inner workings much more clear. I wrote this demo in Ruby, but I think I might port it as an example in C.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: Heise IT-Markt [Crawler] and 20 guests