Skip to content

Commit bd6637e

Browse files
authored
Merge pull request #359 from Gothic-UnZENity-Project/Piotr_VRPlayerItemAdapterFix
Update VRPlayerItemAdapter.cs
2 parents f212d40 + c3ba6f3 commit bd6637e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Assets/UnZENity-VR/Scripts/Adapters/Player/VRPlayerItemAdapter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ public void OnBeforeGrabbed(HVRGrabberBase grabber, HVRGrabbable grabbable)
2626
return;
2727

2828
// In Gothic, Items have no physics when lying around. We need to activate physics for HVR to properly move items into our hands.
29-
grabbable.GetComponent<Rigidbody>().isKinematic = false;
29+
if (grabbable.TryGetComponent<Rigidbody>(out var rb))
30+
{
31+
rb.isKinematic = false;
32+
}
3033
}
3134

3235
}

0 commit comments

Comments
 (0)