Ejemplo n.º 1
0
    void emitVRPositionChange(SteamVR_Input_Sources source, Vector3 value)
    {
        if (ClientManager.instance.state != BaseNetworking.componentState.RUNNING || ClientManager.instance.workerClient == null)
        {
            return;
        }
        Debug.Log("sending position of " + source.ToString() + "=" + value.x + "-" + value.y + "-" + value.z);

        SyncVRPositionMessage message = new SyncVRPositionMessage();

        message.source = source;
        message.posX   = value.x;
        message.posY   = value.y;
        message.posZ   = value.z;
        ClientManager.instance.workerClient.sendMessage(message);
    }
Ejemplo n.º 2
0
    public override void handleMessage(QTMessage message)
    {
        switch (message.messageType)
        {
        case QTMessage.type.INPUT:
            InputMessage inputMessage = (InputMessage)message;

            if (inputMessage.active)
            {
                onClientKeyDown(inputMessage.keyCode);
            }
            else
            {
                onClientKeyUp(inputMessage.keyCode);
            }
            break;

        case QTMessage.type.INPUT_AXIS:
            InputAxisMessage inputAxisMessage = (InputAxisMessage)message;
            updateAxisState(inputAxisMessage.axis, inputAxisMessage.value);
            break;

        case QTMessage.type.VR_ACTION:
            VRActionMessage actionMessage = (VRActionMessage)message;
            updateVRAction(actionMessage.actionName, QTUtils.getValueFromVRActionMessage(actionMessage));
            break;

        case QTMessage.type.SYNC_VR_POSITION:
            SyncVRPositionMessage positionMessage = (SyncVRPositionMessage)message;
            updateVRPosition(positionMessage.source, new Vector3(positionMessage.posX, positionMessage.posY, positionMessage.posZ));
            break;

        case QTMessage.type.SYNC_VR_ROTATION:
            SyncVRRotationMessage rotationMessage = (SyncVRRotationMessage)message;
            updateVRRotation(rotationMessage.source, new Vector3(rotationMessage.rotX, rotationMessage.rotY, rotationMessage.rotZ));
            break;
        }
    }