Simple basketball dribble

Official forum for the Chipmunk2D Physics Library.
Post Reply
gondor
Posts: 1
Joined: Wed Mar 04, 2009 8:52 pm
Contact:

Simple basketball dribble

Post by gondor »

Hi, I love the library btw! I'm fairly new to this and for the life of me I'm pulling my hair out. I have a static shape floor, static line segment 200 pixels above the floor, gravity set for -900 and am simply trying to get a ball to bounce naturally looking between the floor and the line segment, just Y axis. I want the ability to speed it up and slow it down but have had no luck figuring this out.

I've tryed applying forces and impulses and it bounces but not continuous or the height is low then high, etc.

Please any pointers or examples would help me a lot!

thank you :)
ker
Posts: 56
Joined: Tue Jul 15, 2008 4:13 am
Contact:

Re: Simple basketball dribble

Post by ker »

Hey gondor,

Intuitively I'd give the static line segment a velocity downwards, but not add it to the space. This would mean if the ball touches it, the collision gets handled like if the line segment would be moving (if it's strong enough, the ball will accellerate fast enough to move fast enough down to get repelled upwards by the floor). The velocity of the line segment is then your "strength" with which you hit the ball.

You might also need to apply some elasticity value to the ball (and not forget to set elasticityIterations of the space).
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 15 guests