Claw Machine with physics bodies

Godot Version

4.3

Question

Hello,

I’m currently developing a 3D claw machine game and I’m seeking advice on the most appropriate node structure for the claw.

Currently, I’ve set it up as follows:

A CharacterBody3D for the main claw rod, controlled by a script using move_and_slide() for movement.

RigidBody3D nodes for each claw prong, connected to the main rod using hinge joints.

My goal is to allow the claw to close and grab objects by rotating the prong. However, I’m encountering an issue where the prongs detach from the main rod when too much force is applied (e.g., when the rod moves against a wall or moved by others objects) which is not the goal.

I’m not certain of the appropriate way to structure this claw. How can I ensure the prongs remain attached to the rod while still allowing for the closing mechanism ? I thought about animated body for the prong but i’m not sure how can I attach it to the main road.

I’d greatly appreciate any suggestions,
Thanks in advance for your insights!

Probably need to add some mass. Inertia will help resist rotations. Have you tried a static body?

1 Like

Using a bigger mass definitely helps to reduce movement, but it still moves too much when colliding with objects or walls. Static objects work to avoid these movements, but as there is no physics simulation with them, I can’t simulate the claw grip on the item.
Is there a way to emulate significant friction on a joint to make the rotation harder to simulate the grip while allowing objects to fall from the claw if the grip is too weak?
Or maybe I can emulate the claw physics with static bodies but i’m not sure how
Thanks for your help

I forgot there is also an animatedbody3d which is a modification of the static body.

You can add an override physics material to a body and increase friction. But friction depends on both bodies having a similar friction, because the body with the least friction will decide the interaction.

If you want more control you can write your own physics constraints with the integrate forces options.( Only available with rigidbodies, which will most likely be your prize type)

It really depends on how “real” you want to make it. But it will be harder the realer it gets.

1 Like

I ended up using static bodies because animatable bodies cannot be linked with joints or be set as children of rigid bodies, and I couldn’t manage to create a better joint between the rigid bodies. The solution isn’t perfect because there’s no force from the objects on the gripper, but it still works to some extent.