animating a banner sign from the bottom

Official forum for the Chipmunk2D Physics Library.
Post Reply
diLuNa
Posts: 1
Joined: Thu Feb 17, 2011 3:20 am
Contact:

animating a banner sign from the bottom

Post by diLuNa »

I just started using Chipmunk and I'm trying to setup the banner sign as seen in the attachment image.
I want the user to manipulate the banner only touching the bottom handle.
I want the banner to respond to lateral motion with a swing motion that settle down quickly while keeping upright.
I don't want to alter gravity since I may have other objects hanging from the banner sign.

I tried a couple of solutions using a mix of static body for the handle (positioned directly with during touch events) and a body for the banner sign connected via pivot or pin constraints but the result is far from what I want.

Apologies for the newbie question. Thank you in advance for your help.
Luca
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: animating a banner sign from the bottom

Post by slembcke »

I would use a static body or infinite mass rogue body for the handle, and attach the sign body to the static body using a pivot joint and a damped rotary spring. You probably want to smooth out the user input values, and you must calculate a velocity if you want the effect to look correct. I do both in the mouse control code in the Chipmunk demo application: http://code.google.com/p/chipmunk-physi ... Demo.c#226

You can also add a simple motor with a rate of 0 and a maxForce to simulate friction on the pivot if the damping alone on the spring doesn't settle down quickly enough.
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: No registered users and 22 guests