'The "OnCollisionEnter" function isn't being triggered in one case but is being triggered in another case
I'm making a virtual reality application for the oculus platform with the unity engine & experiencing a problem in the process. For some reason, when i'm holding two objects (a hammer & a nail) with my controllers, between the two of them, the "OnCollisionEnter" function isn't being triggered, even though it's being triggered between any one of them & the target surface. Can someone please help me understand why it's happening? Is there a solution to it?
Solution 1:[1]
First make sure that isTrigger is disabled.
Then add Rigidbody to both objects.
Also be sure to use rigidbody
instead of transform
to move and change position.
private Rigidbody rb;
private void Start()
{
rb = GetComponent<Rigidbody>();
}
private void Update()
{
rb.AddForce("some force vector");
rb.MovePosition("some move vector");
}
Solution 2:[2]
It seems that this is a recurring & unresolved issue related to how VR works with the unity engine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | KiynL |
Solution 2 | ahiyantra |