Is there any way in Chipmunk2D for Unity to find out how much force is applied onto a joint in order to see if it should break/be disabled?
I was experimenting with the engine and reached the point where I had the two sides of a trapdoor stable and held with a pivot, but couldn't see how to have the door fall open when hit with sufficient force without having it open at the slightest contact.
Breaking Joints
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Breaking Joints
Oh shoot. Yes there is, and I forgot to expose it in the Unity binding. I just added it to the code and it will be in the next version.
In the meantime, you can add this to ChipmunkConstraint.cs:
Somebody else pointed out that I should implement proper breakable joints like Unity does, so I'll do that too.
In the meantime, you can add this to ChipmunkConstraint.cs:
Code: Select all
/// Get the impulse applied by the constraint on the previous time step.
/// Divide by Time.fixedDeltaTime to get the force.
public float impulse {
get { return (_handle != IntPtr.Zero ? CP._cpConstraintGetImpulse(_handle) : 0f); }
}
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: No registered users and 6 guests