Hey,
I can use PointerEnter, PointerExit, PointerClick operation on ControlPanel’s Cube in HandTracking Demo sample.
I try to do grapb action on Controller’s Cube . then
-
Add Grabbers(NGGrabber_Right, NGGrabber_left) into ControlPanel GameObject and add ItemCollector.cs to ControlPanel
-
Add Rigidbody component with “CollisionDetectionMode== ContinuousDynamics” to ControlPanel’s cube and add the script “CubeInteractiveTest.cs” to let CubeInteractiveTest as NRGrabbableObject as bellow:
public class CubeInteractiveTest: NRGrabbableObject, IPointerClickHandler, IPointerEnterHandler, IPointerExitHandler
{
/// <summary> The mesh render. </summary>
private MeshRenderer m_MeshRender;
/// <summary> Awakes this object. </summary>
// void Awake()
//{
// m_MeshRender = transform.GetComponent<MeshRenderer>();
//}
protected override void Awake()
{
base.Awake();
m_MeshRender = transform.GetComponent<MeshRenderer>();
}
....
}
- I run the demo by pc and try use right hand to do grab action on ControlPanel’s Cube , but NRGrabber.OnTriggerEnter is not trigged.
/// <summary> Executes the 'trigger enter' action. </summary>
/// <param name="other"> The other.</param>
private void OnTriggerEnter(Collider other)
{
NRGrabbableObject grabble = other.GetComponent<NRGrabbableObject>() ?? other.GetComponentInParent<NRGrabbableObject>();
if (grabble == null)
return;
if (m_GrabReadyDict.ContainsKey(grabble))
{
m_GrabReadyDict[grabble] += 1;
}
else
{
m_GrabReadyDict.Add(grabble, 1);
}
}
Anyone know how to do this?
Thank you for the help.