Unity VR Game Basics - PART 14 - Climbing

Поділитися
Вставка
  • Опубліковано 1 жов 2024

КОМЕНТАРІ • 37

  • @tal2259
    @tal2259 2 роки тому +3

    hey i am using continouse movement to move around so i dont use character controller i want to add a rigid body to make the climb() is there a way to change characterController.Move(characterController.transform.rotation * -velocity * Time.fixedDeltaTime); to work with rigidbody instead of character controller ?

  • @게임개발자
    @게임개발자 Рік тому +6

    ❤❤ It's an amazing tutorial course. Thank you for making this available to everyone for free.
    All the videos were error-free, clear and easy to follow.

    • @FistFullofShrimp
      @FistFullofShrimp  Рік тому +1

      I really appreciate this! Thank you so much for your support and kind words! 🍤🍤🍤

  • @zizoSalad8888
    @zizoSalad8888 Рік тому +3

    Hey! I can't find the Hand Complete script, could someone send me?

    • @FistFullofShrimp
      @FistFullofShrimp  Рік тому +3

      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using UnityEngine.XR;
      public class HandComplete : MonoBehaviour
      {
      //Stores handPrefab to be Instantiated
      public GameObject handPrefab;

      //Allows for hiding of hand prefab if set to true
      public bool hideHandOnSelect = false;

      //Stores what kind of characteristics we're looking for with our Input Device when we search for it later
      public InputDeviceCharacteristics inputDeviceCharacteristics;
      //Stores the InputDevice that we're Targeting once we find it in InitializeHand()
      private InputDevice _targetDevice;
      private Animator _handAnimator;
      private SkinnedMeshRenderer _handMesh;
      public void HideHandOnSelect()
      {
      if (hideHandOnSelect)
      {
      _handMesh.enabled = !_handMesh.enabled;
      }
      }
      private void Start()
      {
      InitializeHand();
      }
      private void InitializeHand()
      {
      List devices = new List();
      //Call InputDevices to see if it can find any devices with the characteristics we're looking for
      InputDevices.GetDevicesWithCharacteristics(inputDeviceCharacteristics, devices);
      //Our hands might not be active and so they will not be generated from the search.
      //We check if any devices are found here to avoid errors.
      if (devices.Count > 0)
      {

      _targetDevice = devices[0];
      GameObject spawnedHand = Instantiate(handPrefab, transform);
      _handAnimator = spawnedHand.GetComponent();
      _handMesh = spawnedHand.GetComponentInChildren();
      }
      }
      // Update is called once per frame
      private void Update()
      {
      //Since our target device might not register at the start of the scene, we continously check until one is found.
      if(!_targetDevice.isValid)
      {
      InitializeHand();
      }
      else
      {
      UpdateHand();
      }
      }
      private void UpdateHand()
      {
      //This will get the value for our trigger from the target device and output a flaot into triggerValue
      if (_targetDevice.TryGetFeatureValue(CommonUsages.trigger, out float triggerValue))
      {
      _handAnimator.SetFloat("Trigger", triggerValue);
      }
      else
      {
      _handAnimator.SetFloat("Trigger", 0);
      }
      //This will get the value for our grip from the target device and output a flaot into gripValue
      if (_targetDevice.TryGetFeatureValue(CommonUsages.grip, out float gripValue))
      {
      _handAnimator.SetFloat("Grip", gripValue);
      }
      else
      {
      _handAnimator.SetFloat("Grip", 0);
      }
      }
      }

  • @elisacollins9246
    @elisacollins9246 Рік тому +3

    I found that using the device-specific velocity didn't work for the Oculus Quest 2. It always returned zeros. Instead, for the left controller binding, I chose XR Controller LeftHand -> optional controls -> device velocity. And similar for right.

    • @yashsonar5999
      @yashsonar5999 Рік тому +1

      Thank you so much... I was looking for this solution.

  • @peakhorse120
    @peakhorse120 2 роки тому +4

    This guy deserves thousands of subscribers at least

    • @FistFullofShrimp
      @FistFullofShrimp  2 роки тому

      Thanks so much for saying so! Hopefully I reach 1k soon. It's been a crazy fun journey so far and glad I'm able to help others out on their VR dev journey. Cheers!

  • @BazhNCC-1701
    @BazhNCC-1701 2 місяці тому

    does it work for VRChat platform? If you create a project for VRChat, VRChat provides its own Components and its own GameObjects for the player character, for example when creating a world there will not even be sound unless you add a special component to the sound source. How do I know that your components and gameobjects are physically appropriate for vrchat and do not interfere with it?
    I don't have the player's gameobject in projects for VRChat, it's implemented differently, I cannot just create it

  • @DesuqVidya
    @DesuqVidya 2 роки тому +4

    Thank you for looking into climbing as the last part of the series, really appreciate it! I'll take time to learn, practice, and expand on what you have demonstrated ^^~

    • @FistFullofShrimp
      @FistFullofShrimp  2 роки тому

      Cheers! Glad you found it useful. Let me know if you end up creating something great!

  • @williamducar4642
    @williamducar4642 Рік тому +4

    Great series. Each and every video was clear, informative, concise, and easy to follow. Thanks.

    • @FistFullofShrimp
      @FistFullofShrimp  Рік тому

      Wow!!! I am blown away!. Thank you so much, and I'm glad you've found it helpful. 🍤

    • @justamovie
      @justamovie Рік тому

      I agree. This was on point in several ways. Extraordinary. Looking forward to more in the future.

  • @Yukazikii
    @Yukazikii Рік тому +2

    This is not working for me, for some reason :(
    Followed the video to a teeth

  • @rachelpham8462
    @rachelpham8462 Рік тому +1

    How would i set the velocities/XRI default input actions if I am just using the XR simulated controllers?

  • @InfinityyZA
    @InfinityyZA Рік тому +1

    Thank you, great video. I have a small bug which I was wondering if you could help with, I am attempting to play a sound when hands grab the climbing objects and it works but when I attempt to grab the same climbable object with both hands its as if each hand is activated and deactivated rapidly which causes the audio to play briefly many times. Like 0.1s of audio x20 in a short period of time.

    • @FistFullofShrimp
      @FistFullofShrimp  Рік тому

      It's a bit hard to debug without knowing exactly how you're calling the play sound function. You could try having the XR Grab Interactable trigger the sound through the Interactable Event called "Select Entered".

  • @duraidk634
    @duraidk634 Рік тому

    In Oculus Quest 2 :
    choosing "XRPlugin management" and "Android Tab" and "plugin in provider" Select oculus. Climbing is inactive.
    Then again, choose XRPlugin management->AndroidTab->plugin in provider-> Choose the xrplugin. Climbing is working fine.

  • @bluekriptek100
    @bluekriptek100 2 роки тому +1

    thank you so so so so much, ive always want ed to make vr games but never knew where to start. you have made my life so much easier please never stop making videos, i love them so much. thank you!!!!!

    • @FistFullofShrimp
      @FistFullofShrimp  2 роки тому +1

      Incredibly happy to hear the videos are helping you out! Cheers! Happy learnings!

  • @Kingstantin
    @Kingstantin Рік тому

    This is the ONLY climbing system that works for me. All the other ones, didn't because many comamnds have changed with newer Unity versions.
    I got a question though. I don't know why but if climbing I got stuttering when lifting my self up, which I don't have if I'm moving normaly. I was look everywhere but have kno idea what this causes. Any one has any ideas?

  • @mghersi65
    @mghersi65 Рік тому

    Hi, I would like to know if could be possible to do the same but with XR Plug-in Management set in Oculus (not OpenXR)? I'm using MAC for programing and Oculus Quest 2 to play and only you can climb setting in OpenXR and Windows. Thanks, Mario

  • @devsDGC
    @devsDGC Рік тому

    Doesn’t work on quest because I move like 2 pixels and then never move again, I even got the code on the GitHub and added everything you said and did, and it doesn’t work can someone help

  • @RealPandaLord
    @RealPandaLord Рік тому

    im having an issue where when i grab the ladder I can use both of my hands to climb, even the one that is not currently holding on to something. Im fairly certain that my code is identical to yours so i was wondering if anyone had an idea of whats wrong. Thanks :p

  • @tal2259
    @tal2259 2 роки тому +1

    Thanks for making this guide, cant wait to get back home and give it a try 😁

  • @fernandocgi3874
    @fernandocgi3874 2 роки тому

    Tyvm for this awesome tutorial series, can you teach how interact with light? like turn on and off? ty!

  • @donald1w12
    @donald1w12 2 роки тому +1

    Love the series. Couldn't you just add a rigidbody to the character controller to get gravit?

    • @FistFullofShrimp
      @FistFullofShrimp  2 роки тому +1

      You could, but I believe a character controller and rigidbody aren't meant to work together on the same object. I'd imagine having both on the same thing might cause some funky results.

    • @WraistlinFury
      @WraistlinFury Рік тому

      @@FistFullofShrimp So out of curiosity how would one implement this without a character controller? I can't seem to figure out the code that would work similar to the CharacterController.move code. A standard capsule collider, rigidbody rig.

  • @wormholeinteractive
    @wormholeinteractive 2 роки тому

    Could this code be adjusted to allow the player to sit down instead of climb?

  • @experienceforge
    @experienceforge Рік тому

    Oh I got such a weird bug gang - what do you do if climbing is working on X + Z axis but not the Y axis? :\

  • @crecker1850
    @crecker1850 Рік тому

    can someone give me the second script so i can copy

    • @ribbgtag
      @ribbgtag Рік тому

      using System.Collections;
      using System.Collections.Generic;
      using System;
      using UnityEngine;
      using UnityEngine.InputSystem;
      public class ClimbProvider : MonoBehaviour
      {
      public static event Action ClimbActive;
      public static event Action ClimbInActive;
      public CharacterController characterController;
      public InputActionProperty velocityRight;
      public InputActionProperty velocityLeft;
      private bool _rightActive = false;
      private bool _leftActive = false;
      private void Start()
      {
      XRDirectClimbInteractor.ClimbHandActivated += HandActivated;
      XRDirectClimbInteractor.ClimbHandDeactivated += HandDeactivated;
      }
      private void OnDestroy()
      {
      XRDirectClimbInteractor.ClimbHandActivated -= HandActivated;
      XRDirectClimbInteractor.ClimbHandDeactivated -= HandDeactivated;
      }
      private void HandActivated(string _controllerName)
      {
      if(_controllerName == "LeftHand Controller")
      {
      _leftActive = true;
      _rightActive = false;
      }
      else
      {
      _leftActive = false;
      _rightActive = true;
      }
      ClimbActive?.Invoke();
      }
      private void HandDeactivated(string _controllerName)
      {
      if (_rightActive && _controllerName == "RightHand Controller")
      {
      _rightActive = false;
      ClimbInActive?.Invoke();
      }
      else if (_leftActive && _controllerName == "LeftHand Controller")
      {
      _leftActive = false;
      ClimbInActive?.Invoke();
      }
      }
      private void FixedUpdate()
      {
      if (_rightActive || _leftActive)
      {
      Climb();
      }
      }
      private void Climb()
      {
      Vector3 velocity = _leftActive ? velocityLeft.action.ReadValue() : velocityRight.action.ReadValue();
      characterController.Move(characterController.transform.rotation * -velocity * Time.fixedDeltaTime);
      }
      }