UNITY – 3D Physic – Joints
Using Joints
Fixed Joint – Spring Joints
1. MAIN TOP MENU> GameObject> Capsule1
– Capsule Collider (Inspector> ‘Add Component’> Physics> Capsule Collider)
– Rigid Body (Inspector> ‘Add Component’> Physics> Rigid Body)
– Fixed Joint (Inspector> ‘Add Component’> Physics> Fixed Joint)
Inspector ‘Add Component’>
2. In the viewport under Capsule 1 create
MAIN TOP MENU> GameObject> Capsule2
– Capsule Collider (Inspector> ‘Add Component’> Physics> Capsule Collider)
– Rigid Body (Inspector> ‘Add Component’> Physics> Rigid Body)
– Spring Joint> Connected Body> Capsule1 (Inspector> ‘Add Component’> Physics> Spring Joint)
3. In the viewport under Capsule 2 create
MAIN TOP MENU> GameObject> Capsule3
– Capsule Collider
– Rigid Body
– Spring Joint> Connected Body> Capsule2
The final structure is:
Capsule1 -> Collider + Rigid Body + Fixed Joint
|
Capsule2 -> Collider + Rigid Body + Spring Joint
|
Capsule3 -> Collider + Rigid Body + Spring Joint
Sping Joint Parameters
Anchor: setup the pivot point of the joint (the orange dot in the scene view)
Spring: (molla) 1= soft spring (molla debole), 10= tight spring (molla più rigida), infinity= no spring (molla infinitamente rigida)
Damper: (ammortizzatore)
Min Distance: minimum lenghth of the spring
Max Distance: maximun lenghth of the spring
Break Force: forza da applicare per rompere il vincolo
Break Torque: momento torcente da applicare per rompere il vincolo
Hinge Joints
Hinge Joints are useful to make doors, windows etc..
Create a Box -> apply: Collider + Rigid Body + Hinge Joint
Hinge Joint Parameters
Anchor: setup the pivot point of the joint (the orange dot in the scene view)
Axis: the joint axis, example: to open a door X=0 Y=1 Z=0
Motor: example-> move a automatic gate-> check ‘Use Motor’, Target Velocity:5 Force:4
Limits: example-> limit the door opening-> check ‘Use Limits’, Limits Min:0 Max:90
Break Force: forza da applicare per rompere il vincolo
Break Torque: momento torcente da applicare per rompere il vincolo