Hammer Swing - Joint Break Force and Hammer Object

I’m thinking as to how to approach this Hammer Swing concept while maintaining the joint’s individual break force values.

So the setup is you have a clump of balls jointed together with each joint having a different break force. And you have an Hammer that follows the mouse cursor, which you can use to smash at the clump of balls.

This Hammer is not a Kinematic object, which means the game physics still applies to it. But, no matter how fast you swing your Hammer, it isn’t going to break the clump apart.

I’m assuming this is because the way it’s being updated to the mouse position is just by setting the rigidbody position, which doesn’t give the object any amount of force at all. But there’s still collision detection, so you can still poke at the clump and maybe raise it high enough to let gravity do the work… but that isn’t really using the Hammer as it is meant to be used for.

So, the question is what would I implement to make the mouse movement speed reflect its force on the Hammer object that is attached to it to break the joints?

I currently can think of two approaches to this;

  • I could write something to track the mouse velocity and then apply that to continuously add a force to the object that is following the mouse.

rigidbody.velocity = (mousePosVector - gameObj.transform.position) * speedMultiFloat;

  • Or I could write a line to say whatever this object collides with will destroy any joint regardless of how infinitely strong the break force is… which defeats the purpose of Joint Break Force.

Destroy(GetComponent <ConfigurableJoint>);

When looking at the Velocity documentation, it says not to constantly update velocity as it’ll cause for odd behaviors, but for the first implementation that is ideally what I’m doing.

Looks like I am a bit late to answer, But you could keep track of a delta position for the hammer just so you know how fast user is moving it on screen.
And when collision is detected, you could apply a force X * delta. That way the force you apply is related to the hammer movement speed, and you are allowed to use different break values.