// Use this for initialization
    void Start()
    {
        //Check if this object has a CVirtDeviceController component attached
        deviceController = GetComponent <CVirtDeviceController>();
        if (deviceController == null)
        {
            Debug.LogError("COVRPlayerController gameobject does not have a CVirtDeviceController component attached.");
        }

        //Check if this object has a fowardDirection object child
        forwardDirection = transform.FindChild("ForwardDirection");
        if (forwardDirection == null)
        {
            Debug.LogError("COVRPlayerController gameobject does not have a forwardDirection object attached.");
        }

        //Check if this object has a OVRCameraRig child
        cameraController = gameObject.GetComponentInChildren <OVRCameraRig>();
        if (cameraController == null)
        {
            Debug.LogError("COVRPlayerController gameobject does not have an OVRCameraRig child.");
        }

        //Check if this object hast a CharacterController component attached
        characterController = gameObject.GetComponent <CharacterController>();
        if (characterController == null)
        {
            Debug.LogError("COVRPlayerController gameobject does not have an CharacterController component attached.");
        }
    }
Esempio n. 2
0
    void Awake()
    {
        // Find camera controller
        OVRCameraRig[] CameraControllers;
        CameraControllers = gameObject.GetComponentsInChildren <OVRCameraRig>();

        if (CameraControllers.Length == 0)
        {
            Debug.LogWarning("OVRMainMenu: No OVRCameraRig attached.");
        }
        else if (CameraControllers.Length > 1)
        {
            Debug.LogWarning("OVRMainMenu: More then 1 OVRCameraRig attached.");
        }
        else
        {
            CameraController = CameraControllers[0];
        }

        //Check if this object has a CVirtDeviceController attached
        deviceController = GetComponent <CVirtDeviceController>();
        if (deviceController == null)
        {
            Debug.LogError("CVirtPlayerController gameobject does not have a CVirtDeviceController attached.");
        }
    }
Esempio n. 3
0
    private void Start()
    {
        m_RigidBody        = GetComponent <Rigidbody>();
        m_Capsule          = GetComponent <CapsuleCollider>();
        m_DeviceController = GetComponent <CVirtDeviceController>();
        m_ResetOrientation = true;

        bodyRotation.transform.rotation = new Quaternion(0, cam.transform.rotation.y, 0, cam.transform.rotation.w);
        transform.parent = null;
    }
Esempio n. 4
0
    // Use this for initialization
    void Start()
    {
        //Check if this object has a CVirtDeviceController attached
        deviceController = GetComponent <CVirtDeviceController>();
        if (deviceController == null)
        {
            Debug.LogError("CVirtPlayerController gameobject does not have a CVirtDeviceController attached.");
        }

        this.characterController = GetComponent <CharacterController>();
    }
Esempio n. 5
0
    // Use this for initialization
    void Start()
    {
        // Find the forward direction
        if (this.forwardDirection == null)
        {
            this.forwardDirection = this.transform.Find("ForwardDirection");
        }

        //Check if this object has a CVirtDeviceController attached
        deviceController = GetComponent <CVirtDeviceController>();
        if (deviceController == null)
        {
            Debug.LogError("CVirtPlayerController gameobject does not have a CVirtDeviceController attached.");
        }

        this.characterController = GetComponent <CharacterController>();
    }
Esempio n. 6
0
    public override void OnInspectorGUI()
    {
        CVirtDeviceController targetScript = (CVirtDeviceController)target;

        targetScript.deviceTypeIndex = EditorGUILayout.Popup("Device", targetScript.deviceTypeIndex,
                                                             new string[] {
            "Auto Selection",
            //"Standard Virtualizer Device",
            //"Standard coupled Movement (Keyboard, Gamepad)"
        });
        targetScript.deviceMockupTypeIndex = EditorGUILayout.Popup("Device Mockup", targetScript.deviceMockupTypeIndex,
                                                                   new string[] {
            "Disabled",
            "XInput Mockup (Xbox Controller)"
        });
        targetScript.activateHaptic = EditorGUILayout.Toggle("Haptic Feedback", targetScript.activateHaptic);
        EditorGUILayout.LabelField("", "(only active if supported by the device)");
    }
Esempio n. 7
0
        // Use this to set singletion instance
        void Awake()
        {
            if (singleInstance != null)
            {
                Debug.LogError("There are more than one CVirtHapticListeners in the scene. Please ensure there is always exactly one CVirtHapticListener in the scene.");
            }
            singleInstance = this;

            //Check if this object has a CVirtDeviceController attached
            deviceController = GetComponent <CVirtDeviceController>();
            if (deviceController == null)
            {
                Debug.LogError("CVirtHapticListener gameobject does not have a CVirtDeviceController attached.");
            }

            if (deviceController != null)
            {
                deviceController.OnCVirtDeviceControllerCallback += this.OnCVirtDeviceControllerCallback;
            }
        }