Пример #1
0
        private void Awake()
        {
            // Required Component: VRTK_PlayerPresence
            playerPresence = GetComponent <VRTK_PlayerPresence>();
            if (useGravity)
            {
                if (!playerPresence)
                {
                    playerPresence = gameObject.AddComponent <VRTK_PlayerPresence>();
                }

                playerPresence.SetFallingPhysicsOnlyParams(true);
            }

            headCamera       = VRTK_DeviceFinder.HeadsetTransform();
            headsetCollision = headCamera.GetComponent <VRTK_HeadsetCollision>();
            if (headsetCollision == null)
            {
                headsetCollision = headCamera.gameObject.AddComponent <VRTK_HeadsetCollision>();
            }

            headsetFade = headCamera.GetComponent <VRTK_HeadsetFade>();
            if (headsetFade == null)
            {
                headsetFade = headCamera.gameObject.AddComponent <VRTK_HeadsetFade>();
            }
        }
Пример #2
0
        protected override void Start()
        {
            base.Start();
            adjustYForTerrain = true;

            originalPlaySpaceFalling = playSpaceFalling;

            // Listen for climb events
            var climbComponent = GetComponent <VRTK_PlayerClimb>();

            if (climbComponent)
            {
                climbComponent.PlayerClimbStarted += new PlayerClimbEventHandler(OnClimbStarted);
                climbComponent.PlayerClimbEnded   += new PlayerClimbEventHandler(OnClimbEnded);
            }

            // Required Component: VRTK_PlayerPresence
            playerPresence = GetComponent <VRTK_PlayerPresence>();
            if (useGravity)
            {
                if (!playerPresence)
                {
                    playerPresence = gameObject.AddComponent <VRTK_PlayerPresence>();
                }

                playerPresence.SetFallingPhysicsOnlyParams(true);
            }
        }
Пример #3
0
        protected override void Awake()
        {
            base.Awake();

            // Required Component: VRTK_PlayerPresence
            playerPresence = GetComponent <VRTK_PlayerPresence>();
            if (useGravity)
            {
                if (!playerPresence)
                {
                    playerPresence = gameObject.AddComponent <VRTK_PlayerPresence>();
                }
                playerPresence.SetFallingPhysicsOnlyParams(true);
            }
        }
Пример #4
0
        private void Awake()
        {
            // Required Component: VRTK_PlayerPresence
            playerPresence = GetComponent <VRTK_PlayerPresence>();
            if (useGravity)
            {
                if (!playerPresence)
                {
                    playerPresence = gameObject.AddComponent <VRTK_PlayerPresence>();
                }

                playerPresence.SetFallingPhysicsOnlyParams(true);
            }

            controllerManager = FindObjectOfType <SteamVR_ControllerManager>();
            headCamera        = VRTK_DeviceFinder.HeadsetTransform();
            collisionFade     = headCamera.GetComponent <VRTK_HeadsetCollisionFade>();
            if (collisionFade == null)
            {
                collisionFade = headCamera.gameObject.AddComponent <VRTK_HeadsetCollisionFade>();
            }
        }
Пример #5
0
        private void Start()
        {
            var controllerManager = FindObjectOfType <SteamVR_ControllerManager>();

            InitControllerListeners(controllerManager.left);
            InitControllerListeners(controllerManager.right);

            // Listen for teleport events
            VRTK_BasicTeleport teleportComponent = GetComponent <VRTK_BasicTeleport>();

            if (teleportComponent)
            {
                teleportComponent.Teleporting += new TeleportEventHandler(OnTeleport);
            }

            // Required Component: VRTK_PlayerPresence
            playerPresence = GetComponent <VRTK_PlayerPresence>();
            if (useGravity)
            {
                if (!playerPresence)
                {
                    playerPresence = gameObject.AddComponent <VRTK_PlayerPresence>();
                }

                playerPresence.SetFallingPhysicsOnlyParams(true);
            }

            // Required Component: VRTK_HeadsetCollisionFade
            var headCamera    = VRTK_DeviceFinder.HeadsetTransform();
            var collisionFade = headCamera.GetComponent <VRTK_HeadsetCollisionFade>();

            if (collisionFade == null)
            {
                collisionFade = headCamera.gameObject.AddComponent <VRTK_HeadsetCollisionFade>();
            }
            collisionFade.HeadsetCollisionDetect += new HeadsetCollisionEventHandler(OnHeadsetCollisionDetected);
            collisionFade.HeadsetCollisionEnded  += new HeadsetCollisionEventHandler(OnHeadsetCollisionEnded);
        }