Modeling topspin / backspin

Official forum for the Chipmunk2D Physics Library.
Post Reply
kasmith
Posts: 1
Joined: Mon Jul 08, 2013 2:25 pm
Contact:

Modeling topspin / backspin

Post by kasmith »

Hi,

I'm trying to implement a demonstration in which a ball with a good amount of spin is dropped onto a table, and then should go shooting to the side because of that spin (this is a prelude to projecting a ball with topspin or backspin). However, no matter how high I set the spin of the ball or the friction of the ball and table, the ball simply bounces up and down. Is there a way to get spin friction in Chipmunk (or a way of adding it in during collisions)?

I'm using the pymunk interface to Chipmunk, in case that matters.

Thank you!
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Modeling topspin / backspin

Post by slembcke »

Oh? So you set a non-zero friction value on both the surface and the ball, set the angular velocity of the ball and nothing happens?

The following works trivially:

Code: Select all

	cpFloat radius = 15.0f;
	body = cpSpaceAddBody(space, cpBodyNew(10.0f, cpMomentForCircle(10.0f, 0.0f, radius, cpvzero)));
	cpBodySetPos(body, cpv(0, 240));
	cpBodySetAngVel(body, 50);

	shape = cpSpaceAddShape(space, cpCircleShapeNew(body, radius, cpvzero));
	cpShapeSetElasticity(shape, 0.0f);
	cpShapeSetFriction(shape, 0.9f);
	cpShapeSetElasticity(shape, 0.2f);
Is the moment of inertia of the ball really tiny or something?
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 7 guests