protected void UpdatePosition(SixenseInput.Controller controller, HydraDeckCamera DeckCamera)
    {
        Vector3 BodyPosition = DeckCamera.BodyPosition;

        Vector3 controllerPosition = new Vector3(controller.Position.x,
                                                  controller.Position.y - DeckCamera.HydraFloorY,
                                                  controller.Position.z);

        //Orientate it to our scene
        controllerPosition = DeckCamera.StartCameraOffset * controllerPosition;

        controllerPosition.Scale(DeckCamera.HydraToWorldScale);

        // update the localposition of the object
        this.gameObject.transform.position = BodyPosition + controllerPosition;
    }
Пример #2
0
    protected void UpdatePosition(SixenseInput.Controller controller, HydraDeckCamera DeckCamera)
    {
        if (InitialYCuePosition == 0.0f){
            InitialYCuePosition = this.gameObject.transform.position.y - 0.2f;
        }

        Vector3 BodyPosition = DeckCamera.BodyPosition;
        Vector3 controllerPosition = new Vector3(controller.Position.x,
                                                  InitialYCuePosition,
                                                  controller.Position.z);

        //Orientate it to our scene
        controllerPosition = DeckCamera.StartCameraOffset * controllerPosition;

        controllerPosition.Scale(DeckCamera.HydraToWorldScale);
        if (InitialZControllerPosition == 0.0f){
            InitialZControllerPosition = controllerPosition.z;
        }
        float distance = ((float)(controllerPosition.z - InitialZControllerPosition) * 1.5f);

        // update the localposition of the object
        this.gameObject.transform.position = BodyPosition + controllerPosition;
        this.gameObject.transform.position = new Vector3(gameObject.transform.position.x,
                                          InitialYCuePosition,
                                          gameObject.transform.position.z);
        this.gameObject.transform.localPosition = new Vector3(gameObject.transform.localPosition.x,
                                          gameObject.transform.localPosition.y,
                                          gameObject.transform.position.z + distance);
    }