Jump in VR using the Unity Character Controller - Advanced VR Tutorials

Поделиться
HTML-код
  • Опубликовано: 26 дек 2024

Комментарии • 11

  • @truthsnacks00
    @truthsnacks00 3 месяца назад +1

    worked amazingly, thank you

  • @Sail_VR
    @Sail_VR Год назад +1

    Here's a suggestion for a video. Crouch in VR or Seated Mode

  • @RunjiaChen-k1t
    @RunjiaChen-k1t Год назад +4

    I have implemented jumping according to your method, but there is a situation where jumping and teleportation cannot coexist, and only one function can be implemented separately. May I ask how to solve this problem and can I provide some help?

    • @blackwhalestudio
      @blackwhalestudio  Год назад

      Why does it not work together, can you please elaborate? Make sure you set "Attempting to move" to "Immediate" on your locomotion provider, this might be the issue why you cant jump after teleportation.

  • @nou2769
    @nou2769 Год назад +3

    For some reason this doesn't seem to work unless my character is walking, trying to jump in place causes the jump to be very small

  • @downsideupgoesgroar
    @downsideupgoesgroar Год назад +1

    Suggestion - could you please explain using Asset Bundles with Normcore? (Not addressables). It's very hard to understand their documentation on this subject.

    • @blackwhalestudio
      @blackwhalestudio  Год назад

      Could you please specify what you mean? I can't find any documentation on Asset Bundles from Normcore.

  • @skydoesthingsfan
    @skydoesthingsfan Год назад

    Will it just appear in store and is there any licenses someone needs to fill what's the improvement time?.

  • @samuelhurh1481
    @samuelhurh1481 Год назад +2

    I found that this script got me most of the way there but there was some problems with the jump button not always working. I suspect that this may be due to the constant setting of the playerVelocity.y to a negative value which can momentarily cause the player controller to slip through the ground making .isGrounded false.
    The only thing that's missing is to have a separate global boolean that gets set to true within the if statement scope starting at line 28, having that boolean set to false upon invoking the jump function, and detecting whether or not this boolean is true instead of the conditional on line 22. Me personally, I wrote this code:
    ///////////////////////////////////////////////////////////////
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.InputSystem;
    public class advancedMovement : MonoBehaviour
    {

    public InputActionReference jumpButton = null;
    public CharacterController charController;
    public float jumpHeight;
    private float gravityValue = -9.81f;
    private Vector3 playerVelocity;
    public bool jumpButtonReleased;
    private bool isTouchingGround;
    // Start is called before the first frame update
    void Start()
    {
    jumpButtonReleased = true;
    }
    // Update is called once per frame
    void Update()
    {

    playerVelocity.y += gravityValue * Time.deltaTime;
    charController.Move(playerVelocity * Time.deltaTime);
    if (charController.isGrounded && playerVelocity.y < 0) {
    playerVelocity.y = 0f;
    isTouchingGround = true;
    }
    float jumpVal = jumpButton.action.ReadValue();
    if (jumpVal > 0 && jumpButtonReleased == true) {
    jumpButtonReleased = false;
    Jump();
    isTouchingGround = false;
    } else if (jumpVal == 0){
    jumpButtonReleased = true;
    }
    }
    public void Jump() {
    if (isTouchingGround == false) {
    return;
    }
    playerVelocity.y += Mathf.Sqrt(jumpHeight * -3.0f * gravityValue);
    }

    }
    /////////////////////////////////////////////////////
    It differs in how it detects input from the custom button event when compared to the video.

    • @brucecho18
      @brucecho18 Год назад

      Nice, works great for me.