public void OnColliderEventPressEnter(ColliderButtonEventData eventData)
 {
     if (eventData.IsViveButton(m_activeButton) && eventData.clickingHandlers.Contains(gameObject) && pressingEvents.Add(eventData) && pressingEvents.Count == 1)
     {
         buttonObject.position = buttonOriginPosition + buttonDownDisplacement;
     }
 }
Exemplo n.º 2
0
    public virtual void OnColliderEventDragStart(ColliderButtonEventData eventData)
    {
        if (!eventData.IsViveButton(m_grabButton))
        {
            return;
        }

        var casterPose = GetEventPose(eventData);
        var offsetPose = Pose.FromToPose(casterPose, new Pose(transform));

        if (alignPosition)
        {
            offsetPose.pos = Vector3.zero;
        }
        if (alignRotation)
        {
            offsetPose.rot = Quaternion.identity;
        }

        eventList.AddUniqueKey(eventData, offsetPose);

        if (afterGrabbed != null)
        {
            afterGrabbed.Invoke(this);
        }
    }
Exemplo n.º 3
0
    public void OnColliderEventPressEnter(ColliderButtonEventData eventData)
    {
        Debug.Log("press on");
        if (DownOrUp == 0)
        {
            User.transform.position = new Vector3(User.gameObject.transform.position.x, User.gameObject.transform.position.y - 1, User.gameObject.transform.position.z);
        }
        if (!eventData.IsViveButton(heighlightButton))
        {
            return;
        }

        presses.Add(eventData);

        // check if this evenData is dragging me(or ancestry of mine)
        for (int i = eventData.draggingHandlers.Count - 1; i >= 0; --i)
        {
            if (transform.IsChildOf(eventData.draggingHandlers[i].transform))
            {
                drags.AddUnique(eventData);
                break;
            }
        }

        UpdateMaterialState();
    }
Exemplo n.º 4
0
 public void OnColliderEventPressEnter(ColliderButtonEventData eventData)
 {
     if (eventData.IsViveButton(heighlightButton) && presses.Add(eventData) && presses.Count == 1)
     {
         SetMaterial(Pressed);
     }
 }
Exemplo n.º 5
0
    public void OnColliderEventDragStart(ColliderButtonEventData eventData)
    {
        if (!eventData.IsViveButton(m_grabButton))
        {
            return;
        }

        dragEvent = eventData;

        grabOffsetPos = alignPosition ? Vector3.zero : eventData.eventCaster.transform.InverseTransformPoint(transform.position);
        grabOffsetRot = alignRotation ? Quaternion.identity : Quaternion.Inverse(eventData.eventCaster.transform.rotation) * transform.rotation;
    }
Exemplo n.º 6
0
    public void OnColliderEventPressEnter(ColliderButtonEventData eventData)
    {
        if (!eventData.IsViveButton(heighlightButton))
        {
            return;
        }

        presses.Add(eventData);

        // check if this evenData is dragging me(or ancestry of mine)
        for (int i = eventData.draggingHandlers.Count - 1; i >= 0; --i)
        {
            if (transform.IsChildOf(eventData.draggingHandlers[i].transform))
            {
                drags.AddUnique(eventData);
                break;
            }
        }

        UpdateMaterialState();
    }