Understanding Unity: Hinge Joint — Anchor Axis, Spring, Motor and Limits
[Personal Devlog: August 16, 2023]
Unity’s Hinge Joint component that constrains the attached game object, allowing it to move like being connected to a hinge. The component can be used in various occasions, such as turbofan, hanging sign posts, openable door, self-rotating gear etc.
This experiment does not cover all the parameters that are included in Hinge Joint component. The rest is up to the reader to find out the best use cases.
Experiments on Anchor of 3D Axis
If the values of axis are set to 0, by default Unity will have the game object rotate around X axis.
If situation demands, it would be better to specify which axis we would like the game object to rotate around.
Rotating on X Axis
Rotating on Y Axis
Rotating on Z Axis
Experiment on Spring
Spring option indicates the force applied to the object to “calm” down the rotating momentum.
The value can be set from 0 to infinity. Infinity indicates that the game object will not swing at all.
Experiments on Motor
Set Use Motor to true will automatically apply force and spinning velocity to the game object. Target velocity means the maximum velocity the game object can reach by applied force.
If Target Velocity is set to 0, the game object would not move since there is no intrinsic momentum.
Experiments on Limits
Use Limits parameters will constrain the game object to rotate around pre-destined angle. Bounciness is how “bouncy” when the game object hits the limit.
Bounciness of the game object is also effected by game object’s mass and gravity in Rigidbody component. Better to experiment on all these parameters to obtain desired physics effects.