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 ?
❤❤ 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.
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); } } }
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.
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!
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
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 ^^~
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.
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".
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.
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!!!!!
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?
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
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
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
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.
@@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.
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 ?
❤❤ 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.
I really appreciate this! Thank you so much for your support and kind words! 🍤🍤🍤
Hey! I can't find the Hand Complete script, could someone send me?
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);
}
}
}
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.
Thank you so much... I was looking for this solution.
This guy deserves thousands of subscribers at least
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!
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
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 ^^~
Cheers! Glad you found it useful. Let me know if you end up creating something great!
Great series. Each and every video was clear, informative, concise, and easy to follow. Thanks.
Wow!!! I am blown away!. Thank you so much, and I'm glad you've found it helpful. 🍤
I agree. This was on point in several ways. Extraordinary. Looking forward to more in the future.
This is not working for me, for some reason :(
Followed the video to a teeth
How would i set the velocities/XRI default input actions if I am just using the XR simulated controllers?
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.
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".
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.
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!!!!!
Incredibly happy to hear the videos are helping you out! Cheers! Happy learnings!
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?
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
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
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
Thanks for making this guide, cant wait to get back home and give it a try 😁
Have fun with it! Cheers!!!
Tyvm for this awesome tutorial series, can you teach how interact with light? like turn on and off? ty!
Love the series. Couldn't you just add a rigidbody to the character controller to get gravit?
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.
@@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.
Could this code be adjusted to allow the player to sit down instead of climb?
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? :\
Did you fix it?
can someone give me the second script so i can copy
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);
}
}