Can't get elasticity?

Official forum for the Chipmunk2D Physics Library.
digicide
Posts: 15
Joined: Wed Aug 20, 2008 8:11 pm
Contact:

Can't get elasticity?

Post by digicide »

I was using an older version of chipmunk, one that still had the ball with a stick attached for demo 6 instead of the bricks in water. Anyway, elasticity used to work great, but I can't get anything to bounce in the new version. I haven't altered it since checkout except to up the shape->e in a few places for testing. I'm on Mac OS X using the default xCode project. Does anyone know what I'm missing?
maximile
Posts: 157
Joined: Mon Aug 20, 2007 12:53 pm
Location: London, UK
Contact:

Re: Can't get elasticity?

Post by maximile »

I've just tested this and noticed the same problem.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Can't get elasticity?

Post by slembcke »

as part of the solution to solve jittering elastic resting collisions I separated out elastic collision solving. You now have to set space.elasticIterations separately from normal iterations. It also defaults to 0 to avoid slowing don simulations without elasticity.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
digicide
Posts: 15
Joined: Wed Aug 20, 2008 8:11 pm
Contact:

Re: Can't get elasticity?

Post by digicide »

Perfect!

Thanks for a great physics engine!
supertommy
Posts: 56
Joined: Tue Sep 11, 2007 2:30 pm
Contact:

Re: Can't get elasticity?

Post by supertommy »

I also remember spending a few hours scratching my head over why my boxes wouldn't bounce, when I moved to the latest version. Wouldn't it be more user-friendly to default space.elasticIterations to 10 or whatever, and let those who need that extra bit of speed change it to 0?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Can't get elasticity?

Post by slembcke »

I guess I didn't expect elasticity to be that widely used.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
supertommy
Posts: 56
Joined: Tue Sep 11, 2007 2:30 pm
Contact:

Re: Can't get elasticity?

Post by supertommy »

Well, I guess it would depend what kind of environment you want to simulate. I'd think most everyday objects (balls, boxes, rocks, knives) would be at least semi-elastic.
tucano
Posts: 4
Joined: Fri Apr 04, 2008 8:58 am
Contact:

Re: Can't get elasticity?

Post by tucano »

HI,

there is a way to set elasticIterations in ruby binding?

I can't find the relates function in rb_cpSpace.c

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

Re: Can't get elasticity?

Post by slembcke »

:oops: No there is not. I totally missed that.

Edit: I added one in trunk.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
tucano
Posts: 4
Joined: Fri Apr 04, 2008 8:58 am
Contact:

Re: Can't get elasticity?

Post by tucano »

Yeah many thanks.

I have updted the doc_dummy.rb files (in docsrc) to follow this change... :)

may be you want to add it also to the trunk? thanks

svn diff:

Code: Select all

===================================================================
--- doc_dummy.rb        (revision 28)
+++ doc_dummy.rb        (working copy)
@@ -278,6 +278,10 @@
     # The amount of gravity in the system. Must be a CP::Vect.
     attr_accessor :gravity
     
+    # Coefficient of restitution. (elasticity)
+    attr_accessor :elastic_iterations
+    
+
     def initialize; end
     
     # Add a block to be called when a collision between a shape with a
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests