void Update()
    {
        //Directions obtained from CC_CANOE class. We use the Right wand and Head for orientation.
        //Where the right wand is pointed is the direction the player will move
        Vector3 forwardDir = CC_CANOE.WandGameObject(Wand.Right).transform.forward;
        Vector3 rightDir   = CC_CANOE.HeadGameObject().transform.right;

        rightDir = Vector3.Normalize(Vector3.ProjectOnPlane(rightDir, Vector3.up));
        Vector3 upDir = Vector3.up;

        //The input from the trigger axis of the left wand
        float forward = CC_INPUT.GetAxis(Wand.Right, WandAxis.Trigger);

        //Move the CharacterController attached to the CC_CANOE.
        Vector3 movement = forwardDir * forward;

        charCont.Move(movement * Time.deltaTime * moveSpeed);

        //The input from the X and Y axis of the right wand joystick.
        yAxisChange += CC_INPUT.GetAxis(Wand.Right, WandAxis.XAxis) * Time.deltaTime * lookSpeed;
        yAxisChange  = yAxisChange % 360.0f;
        xAxisChange += CC_INPUT.GetAxis(Wand.Right, WandAxis.YAxis) * Time.deltaTime * lookSpeed;
        xAxisChange  = Mathf.Clamp(xAxisChange, -maxPitch, maxPitch);

        //Change the direction the CharacterController is facing.
        charCont.transform.rotation = Quaternion.identity;
        charCont.transform.RotateAround(CC_CANOE.CanoeGameObject().transform.position, Vector3.up, yAxisChange);
        charCont.transform.RotateAround(CC_CANOE.CanoeGameObject().transform.position, rightDir, xAxisChange);
    }
    // Update is called once per frame
    void Update()
    {
        //Head tracking
        Transform source = CC_CANOE.HeadGameObject().transform;

        headReference.transform.position      = convertPosition(source.position);
        headReference.transform.localRotation = convertRotation(source.rotation);

        //Left wand tracking
        source = CC_CANOE.WandGameObject(Wand.Left).transform;
        leftWandReference.transform.position      = convertPosition(source.position);
        leftWandReference.transform.localRotation = convertRotation(source.rotation);

        //Right wand tracking
        source = CC_CANOE.WandGameObject(Wand.Right).transform;
        rightWandReference.transform.position      = convertPosition(source.position);
        rightWandReference.transform.localRotation = convertRotation(source.rotation);

        //Waist tracking
        waistReference.transform.localPosition = convertPuckPosition(waistReference.transform.localPosition, 0);
        waistReference.transform.localRotation = convertPuckRotation(0);

        //Left foot tracking
        leftFootReference.transform.localPosition = convertPuckPosition(leftFootReference.transform.localPosition, 1);
        leftFootReference.transform.localRotation = convertPuckRotation(1);

        //Right foot tracking
        rightFootReference.transform.localPosition = convertPuckPosition(rightFootReference.transform.localPosition, 2);
        rightFootReference.transform.localRotation = convertPuckRotation(2);
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        headPos = CC_CANOE.HeadGameObject().transform.position;

        ccPosition = controller.center;

        transform.position = new Vector3(headPos.x + originalPos.x, 0, headPos.z + originalPos.z);
    }
    // Use this for initialization
    void Start()
    {
        animator = GetComponent <Animator>();

        controller = CC_CANOE.CanoeCharacterController();

        parentTransform    = transform.GetComponentInParent <Transform>();
        headTransform      = CC_CANOE.HeadGameObject().gameObject.transform;
        leftHandTransform  = CC_CANOE.WandGameObject(Wand.Left).gameObject.transform;
        rightHandTransform = CC_CANOE.WandGameObject(Wand.Right).gameObject.transform;

        //Initial call to chest puck
        VRPN.vrpnTrackerQuat("CC_FLAT_PUCK0@" + CC_CONFIG.innovatorIP, 0);

        //Brings model out of ground
        offset = new Vector3(0, 2f * transform.GetChild(0).GetComponent <SkinnedMeshRenderer>().bounds.extents.x, 0);
        transform.localPosition = offset;

        leftMirrorGoal  = transform.parent.GetChild(1).transform;
        rightMirrorGoal = transform.parent.GetChild(2).transform;
    }