У нас вы можете посмотреть бесплатно VR Locomotion with Raycasting for Collision Detection или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
In this video, you'll learn how to set up raycasting for your locomotion system to deter players from going through walls. This system is NOT 100% perfect (for that, you'll have to check out the next video,) but it is pretty close for flat ground. See the completed version of the script below. using System.Collections; using System.Collections.Generic; using UnityEngine; using HTC.UnityPlugin.Vive; public class MoveWithLocomotion : MonoBehaviour { public Transform viveRig; public Transform viveCameraEye; public Vector2 controllerTrackpadInput; private float height; private void Start() { height = viveCameraEye.position.y; Debug.Log(height); } void Update() { Vector3 eyeForward = viveCameraEye.forward; eyeForward.y = 0; Vector3 eyeRight = viveCameraEye.right; eyeRight.y = 0; controllerTrackpadInput = ViveInput.GetPadTouchAxis(HandRole.RightHand); Vector3 position = eyeForward * controllerTrackpadInput.y + eyeRight * controllerTrackpadInput.x; position = position.normalized; Ray eyeRay = new Ray(viveCameraEye.position, position); Ray kneeRay = new Ray(viveCameraEye.position - Vector3.up * height * 0.75f, position); RaycastHit eyeHit; RaycastHit kneeHit; if (!Physics.Raycast(eyeRay, out eyeHit, 1f)) { if (!Physics.Raycast(kneeRay, out kneeHit, 1f)) viveRig.position += position * Time.deltaTime * 5f; } } }