Chipmunk 6.0 Beta

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:

Re: Chipmunk 6.0 Beta

Post by slembcke »

Hmm. I've replicated the first issue and have an idea of what's causing it.

Not sure what is up with the second issue, the benchmarks don't even call that function I don't think. Which demo was it failing on?

edit: Oooh. I bet you clicked on some of the static geometry with the mouse? (the mouse's pivot joint does use that function.) In the normal demos I use layers to prevent you from attaching the mouse joint to static geometry, but didn't bother with the benchmark demos. Is that it maybe?
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
aisman
Posts: 145
Joined: Tue Mar 04, 2008 2:21 am
Contact:

Re: Chipmunk 6.0 Beta

Post by aisman »

slembcke wrote:edit: Oooh. I bet you clicked on some of the static geometry with the mouse? (the mouse's pivot joint does use that function.) In the normal demos I use layers to prevent you from attaching the mouse joint to static geometry, but didn't bother with the benchmark demos. Is that it maybe?
Right! I clicked on some objects during demo was running.
Chipmunk4PB: The fastest way to write games together with PureBasic and the Chipmunk physics engine.
JavierTapulous
Posts: 13
Joined: Fri Apr 01, 2011 3:17 pm
Contact:

Re: Chipmunk 6.0 Beta

Post by JavierTapulous »

Hey man, thanks for the update :D

I've updated chipmunk to 6.0 beta and i found an issue with removing stuff on a running space.

Basically i'm getting crashes with
cpSpaceRemoveStaticShape
and
cpSpaceRemoveShape

It seems to remove entities just fine for a while. but after removing several it crashes:

#0 arbiterSetFilterRemovedShape (arb=0xae0c0c0, context=0x2fdfe1f0) at cpSpace.c:367
#1 0x000d3cca in cpHashSetFilter (set=0xae0c0c0, func=0xd4db9 <arbiterSetFilterRemovedShape+1>, data=0x2fdfe1f0) at cpHashSet.c:244
#2 0x000d4d9c in cpSpaceRemoveStaticShape (space=0x4cee70, shape=0xae0c040) at cpSpace.c:412

while(node && node != arb){
prev_ptr = (node->body_a == body ? &node->next_a : &node->next_b);
EXC_BAD_ACCESS crash on that line

UPDATE:
When running on debug mode chipmunk asserts with the following:
cpAssert(node, "Internal Error: Attempted to remove an arbiter from a body it was never attached to.");

On that very same cpSpaceRemoveStaticShape function
JavierTapulous
Posts: 13
Joined: Fri Apr 01, 2011 3:17 pm
Contact:

Re: Chipmunk 6.0 Beta

Post by JavierTapulous »

One thing that changed that was breaking some stuff for me, was that the bounding box wasn't being set on the shape creation.

My fix was to simply add
cpShapeUpdate(shape, shape->body->p, shape->body->rot);
after creating a shape.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Chipmunk 6.0 Beta

Post by slembcke »

Yeah somebody else pointed out the arbiter bug/assertion too. Though it was triggered in a slightly different way. I'm going to be pretty swamped for the next few week or so unfortunately. If I get frustrated with work and need a break I'll look into it though. ;)

I'll have to make sure to add a not to the documentation about the bounding box stuff. It was never really well defined before when the collision data for a shape was valid and now the behavior has changed slightly. Basically a shape's position data is only valid after calling cpSpaceStep() if you didn't move the object in a callback, and after calling cpShapeUpdate().
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
mcc
Posts: 27
Joined: Sun Mar 30, 2008 9:00 pm
Contact:

Re: Chipmunk 6.0 Beta

Post by mcc »

Very interested in the variable time step support.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Chipmunk 6.0 Beta

Post by slembcke »

mcc wrote:Very interested in the variable time step support.
Again, just keep in mind that it still doesn't do swept collisions. Decreasing the timestep works great if you want to slow down time, but increasing the timestep it can cause missed collisions.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Chipmunk 6.0 Beta

Post by slembcke »

Ok, so I fixed the arbiter removal assertion/bug. It turned out to be pretty simple.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
viblo
Posts: 206
Joined: Tue Aug 21, 2007 3:12 pm
Contact:

Re: Chipmunk 6.0 Beta

Post by viblo »

Great to see that Chipmunk 6 is almost ready for release!

While testing pymunk with the newest 6.x-branch, I noticed that the direction of cpArbiterTotalImpulse is reversed compared to the previous version?

Some python code that fails on the assert because the resulting total impulse is now positive in x instead of negative, not sure if it helps, but at least it should be quite easy to follow even for non-python programmers:

Code: Select all

s = p.Space()

b1, b2 = p.Body(1,10),p.Body(p.inf,p.inf)
s.add(self.b1)
b1.position = -10,1
b2.position = 0,0

s1, s2 = p.Circle(b1,2), p.Circle(b2,2)
s.add(s1, s2)

s1.collision_type = 1
s2.collision_type = 2  

s1.elasticity = 0.5
s2.elasticity = 0.5
s1.friction = 0.8
s2.friction = 0.7

b1.apply_impulse((10,0))
def post_solve(space, arb):
    assertAlmostEqual(arb.total_impulse.x, -11.25) #total_impulse calls cpArbiterTotalImpulse
    return True
        
s.add_collision_handler(1,2, None, None, post_solve, None)
        
for x in range(7):
    s.step(0.1)
http://www.pymunk.org - A python library built on top of Chipmunk to let you easily get cool 2d physics in your python game/app
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Chipmunk 6.0 Beta

Post by slembcke »

Hmm. The couple of examples I have are fine. I'll look into this some more.
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 11 guests