Breaking joints/constraints and magnet effect?
Posted: Tue Oct 26, 2010 6:40 pm
Hello,
I want some objects ( bodies & shapes ) to be dragged around with the mouse, then stick to a wall, then be able to be pulled from the wall with the mouse ( this is on iPhone ).
I have the mouse as a body that touches another body and I connect a joint between them and pull it around. Works fine. I also have a wall that I connect a joint between the body I am dragging and the wall when the body touches it ( also works fine - other than the body sometimes slightly shakes while it is connected to the wall ). I was thinking if my maxForce of the mouse body was greater than that of the joint, that the joint would break when the mouse grabs it again and pulls it away, but it doesn't. Am I not correct? I searched some throughout the day today but didn't find anything, but maybe I am using the wrong search terms. ( break joint/constraint ).
I can solve this by adding code to change the object being attached to the wall to static ( then it won't bounce ) and adding grab logic to change it back and remove the constraint when the mouse touches it. But I thought I had read somewhere that Chipmunk had breakable joints ( also I see functions for it - although commented out in SpaceManager.mm ). Anything chipmunk can do for me on the bouncing shapes ( when attached ) as well?
Regards,
rfkrakora
I want some objects ( bodies & shapes ) to be dragged around with the mouse, then stick to a wall, then be able to be pulled from the wall with the mouse ( this is on iPhone ).
I have the mouse as a body that touches another body and I connect a joint between them and pull it around. Works fine. I also have a wall that I connect a joint between the body I am dragging and the wall when the body touches it ( also works fine - other than the body sometimes slightly shakes while it is connected to the wall ). I was thinking if my maxForce of the mouse body was greater than that of the joint, that the joint would break when the mouse grabs it again and pulls it away, but it doesn't. Am I not correct? I searched some throughout the day today but didn't find anything, but maybe I am using the wrong search terms. ( break joint/constraint ).
I can solve this by adding code to change the object being attached to the wall to static ( then it won't bounce ) and adding grab logic to change it back and remove the constraint when the mouse touches it. But I thought I had read somewhere that Chipmunk had breakable joints ( also I see functions for it - although commented out in SpaceManager.mm ). Anything chipmunk can do for me on the bouncing shapes ( when attached ) as well?
Regards,
rfkrakora