Beispiel #1
0
 public Controller(
     ButtonMap buttonMap       = null,
     Stick2DMap rightStickMap  = null,
     Stick3DMap rightHandMover = null,
     Stick2DMap leftStickMap   = null,
     Stick3DMap leftHandMover  = null,
     float handScale           = 0.3f,
     float handSpeed           = 0.1f
     )
 {
     this.buttonMap = buttonMap;
     this.rightHand = new VRController(
         handAnchorName: "RightHandAnchor",
         stick: OVRInput.RawAxis2D.RThumbstick,
         stickMap: rightStickMap,
         positionMover: rightHandMover,
         scale: handScale,
         speed: handSpeed,
         this.IsOnHeadset()
         );
     this.leftHand = new VRController(
         handAnchorName: "LeftHandAnchor",
         stick: OVRInput.RawAxis2D.LThumbstick,
         stickMap: leftStickMap,
         positionMover: leftHandMover,
         scale: handScale,
         speed: handSpeed,
         this.IsOnHeadset()
         );
 }
        public VRController(string handAnchorName, OVRInput.RawAxis2D stick, Stick2DMap stickMap, Stick3DMap positionMover, float scale, float speed, bool onHeadSet)
        {
            this.handAnchor    = GameObject.Find(handAnchorName);
            this.stick         = stick;
            this.stickMap      = stickMap;
            this.positionMover = positionMover;
            this.speed         = speed;
            this.onHeadSet     = onHeadSet;

            if (!onHeadSet)
            {
                this.cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
                this.cube.transform.position   = this.position;
                this.cube.transform.localScale = new Vector3(1, 1, 1) * scale;
            }
        }