Reputation: 101
I am trying to make a claw machine and I don't want the claw to be able to rotate freely on the pin joint. How would I go about this.
And if RigidBodies and PinJoints are not the way to go with a claw machine, is there a better way?
Upvotes: 0
Views: 85
Reputation: 548
If you want the claw to always be pointing down, i.e. not allowed to rotate relative to the ground, then the advice given in this thread How to limit rotation on a RigidBody2D? should still apply, as it is still of the RigidBody class (although some specifics will change between the 2D and 3D versions of nodes, if needed.
If you want the claw to not rotate relative to whatever it is attached to, then there are many ways to accomplish this. One way, which would still use your PinJoint
, would be to set the joint's angular_limit_enabled
, angular_limit_lower
, and angular_limit_upper
parameters to restrict movement. You want to restrict it to not move at all, so set angular_limit_enabled=true
,angular_limit_lower=yourAngleHere
, and angular_limit_upper=yourAngleHere
. This can be done in the editor or manually in a script. See https://docs.godotengine.org/en/stable/classes/class_pinjoint2d.html#class-pinjoint2d for details.
Upvotes: 0