I'll admit I'm a bit of a slow learner, it's easier for me to watch and do. Is anyone aware of/planning on making a course for Godot in VR? I could keep looking at tutorials on YouTube, but I can't even get the tutorial project by Proclivity and others to work. I have an Oculus Quest 2, and know how to use Link/AirLink. I made a basic project with an empty world and boxes for hands, and that is really all I can do. I still struggle to even export a second project. All the course I find for VR are for Unity or Unreal, and some YouTube videos are already outdated.
I haven’t looked at VR in a long time… don’t even have the headset anymore 😅
VR in Godot is cool, but yeah, unfortunately there is not very much material on it. I used basic Unity tutorials when I wrote the tutorial as a base and to get an idea on how to make VR projects and code, so that might be a helpful reference.
Huh. I left Unity shortly after things started to go sideways for them, but I had little to no experience in VR with it. The only saving grace I had there was Auto Hands, which I will leave the asset link here. Plus, I switched to GDScript, so I never did C# with Godot- save maybe a few tries.
https://assetstore.unity.com/packages/tools/game-toolkits/auto-hand-vr-physics-interaction-165323
The downside to Auto Hands, obviously, was that I didn't ever learn the basic grab/distance grab code, player movement- either by teleporting or smooth movement, rotation, nothing. It was a lazy way out, if not the only way I knew that worked.
I guess I'm just looking for anyone wiling to cover the basics, and if I have to pay a bit to learn them, I will do so. VR is my all-time favorite platform ATM, and I want to eventually build solid, bug-free games. But first, I have to take the baby steps.
I managed to build a VR project and look around in it. I have an updated version that has hands as well. And that's all I can do ATM. Not sure if it helps anyone.
https://1drv.ms/u/s!AgQKenLrWBXeje4Oa1eWieTMR18rrg?e=GCA2aB
A few pluses would be learning to craft and make an inventory system- I never figured out inventory, even in Unity, but even basics would give me enough to build a puzzle game.
Okay, I found this video, but things aren't set up exactly as shown on mine. I currently only can move forwards and backwards, turn by physically turning, and fall off the edge. I still don't understand smooth rotation, grabbing/dropping, or interacting in general.
I guess I'll have to keep digging.
Some progress! So, in order to get the character to rotate, I had to convert the strafe ability in the direct_movement script to rotate the player. I'll add the code here. I am honestly not sure why it added all this extra stuff, but, hey. The code works when Strafe- now player rotation- is on.
tool
class_name Function_DirectMovement
extends MovementProvider
##
## Movement Provider for Direct Movement
##
## @desc:
## This script works with the Function_Direct_movement asset to provide
## direct movement for the player. This script works with the PlayerBody
## attached to the players ARVROrigin.
##
## The following types of direct movement are supported:
## - Slewing
## - Forwards and backwards motion
##
## The player may have multiple direct movement nodes attached to different
## controllers to provide different types of direct movement.
##
#Extra Feature for rotation, this swaps strafing ability with rotation ability
onready var FPController = get_node("../..")
## Movement provider order
export var order := 10
## Movement speed
export var max_speed := 10.0
## Enable player strafing
export var strafe := false
# Controller node
onready var _controller : ARVRController = get_parent()
# Perform jump movement
func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool):
# Skip if the controller isn't active
if !_controller.get_is_active():
return
# Apply forwards/backwards ground control
player_body.ground_control_velocity.y += _controller.get_joystick_axis(1) * max_speed
# Apply left/right ground control
if strafe:
#player_body.ground_control_velocity.x += _controller.get_joystick_axis(0) * max_speed
FPController.rotation_degrees.y += _controller.get_joystick_axis(0) * max_speed * -0.05
# Clamp ground control
player_body.ground_control_velocity.x = clamp(player_body.ground_control_velocity.x, -max_speed, max_speed)
player_body.ground_control_velocity.y = clamp(player_body.ground_control_velocity.y, -max_speed, max_speed)
# This method verifies the MovementProvider has a valid configuration.
func _get_configuration_warning():
# Check the controller node
var test_controller = get_parent()
if !test_controller or !test_controller is ARVRController:
return "Unable to find ARVR Controller node"
# Call base class
return ._get_configuration_warning()
I just got the movement down. Here, feel free to use. This allows you to switch which hand does what. From what I've seen, one hand does rotation, and the other does the movement and strafing. I will also note, as one game has given me heck for this, note that jumping is not easily done with the same controller as what does the main movement- it is best done in the hand with the rotation. Also, a side note, the rotation hand will most likely also be the one to hold gadgets like a flashlight. I've seen a game that didn't do that, and I had to try to use the main hand to shine a light and do everything else. Not cool.
tool
class_name Function_DirectMovement
extends MovementProvider
##
## Movement Provider for Direct Movement
##
## @desc:
## This script works with the Function_Direct_movement asset to provide
## direct movement for the player. This script works with the PlayerBody
## attached to the players ARVROrigin.
##
## The following types of direct movement are supported:
## - Slewing
## - Forwards and backwards motion
##
## The player may have multiple direct movement nodes attached to different
## controllers to provide different types of direct movement.
##
#Extra Feature for rotation, this swaps strafing ability with rotation ability
onready var FPController = get_node("../..")
## Movement provider order
export var order := 10
## Movement speed
export var max_speed := 10.0
## Enable player strafing
export var strafe := false
# Enable player rotation
export var rotate = true
#Enable player basic movement
export var movement = true
# Controller node
onready var _controller : ARVRController = get_parent()
# Perform jump movement
func physics_movement(delta: float, player_body: PlayerBody, _disabled: bool):
# Skip if the controller isn't active
if !_controller.get_is_active():
return
# Apply forwards/backwards ground control
if movement == true:
player_body.ground_control_velocity.y += _controller.get_joystick_axis(1) * max_speed
# Apply left/right ground control
if strafe:
player_body.ground_control_velocity.x += _controller.get_joystick_axis(0) * max_speed
else:
FPController.rotation_degrees.y += _controller.get_joystick_axis(0) * max_speed * -0.05
# Clamp ground control
player_body.ground_control_velocity.x = clamp(player_body.ground_control_velocity.x, -max_speed, max_speed)
player_body.ground_control_velocity.y = clamp(player_body.ground_control_velocity.y, -max_speed, max_speed)
# This method verifies the MovementProvider has a valid configuration.
func _get_configuration_warning():
# Check the controller node
var test_controller = get_parent()
if !test_controller or !test_controller is ARVRController:
return "Unable to find ARVR Controller node"
# Call base class
return ._get_configuration_warning()
Learning quite a bit. I'm using OpenXR and so far can still follow along as he uses XR tools.
Wow. Does anyone understand this list? IDK, but it loos very confusing. I'm assuming they're the buttons on the Quest?
I guess AX is the A or X button? IDK.
I believe the jump is usually X or A, depending on which one is the off-hand- although those could also be grab in other games- in which case Y and B is jump IIRC.
enum Buttons {
VR_BUTTON_BY = 1,
VR_GRIP = 2,
VR_BUTTON_3 = 3,
VR_BUTTON_4 = 4,
VR_BUTTON_5 = 5,
VR_BUTTON_6 = 6,
VR_BUTTON_AX = 7,
VR_BUTTON_8 = 8,
VR_BUTTON_9 = 9,
VR_BUTTON_10 = 10,
VR_BUTTON_11 = 11,
VR_BUTTON_12 = 12,
VR_BUTTON_13 = 13,
VR_PAD = 14,
VR_TRIGGER = 15
}
Cumulous I guess AX is the A or X button? IDK.
I would think it's the button under the analog stick, so when you press down on the analog stick it also acts as a button, but that's just a guess on my part.
I wonder... I don't know how to add UI to a VR game yet. If I could add a label, I could make the buttons I press pop up on screen. That would show me what's what.
I don't know how Godot is doing it, but generally AX and BY are going to be referring to either the upper or lower button on a controller.
On Oculus and HP Reverb G2 controllers, the left hand has X and Y buttons and the right hand has A and B. So VR_BUTTON_AX would be the X button if you are checking the left controller or A if checking the right controller.
Checkmate! I switched up the pickup code like so:
func _on_button_pressed(p_button) -> void:
print(p_button)
if p_button == pickup_button_id:
if is_instance_valid(picked_up_object) and !picked_up_object.press_to_hold:
drop_object()
elif is_instance_valid(closest_object):
_pick_up_object(closest_object)
elif p_button == action_button_id:
if is_instance_valid(picked_up_object) and picked_up_object.has_method("action"):
picked_up_object.action()
And, actually, the buttons on the joystick are 14.
y and b are 1.
The grips are 2.
a and x- 7
the triggers are 15.
IDK why they're labeled like that... but now, how do I only tell x to do something and not a, or vise versa...? Hm.
I think I know enough to build games in VR now. I'll see what sort of trouble I can cause... 🦹♀️
So I'm trying to go for a spooky, see nothing darkness in the game, sort of like this?
It works wonders in the editor, but it's two or three times as light in the oculus. Is there a way to not entirely make it pitch black in the VR? One of my tests made it completely pitch black- that wasn't good.
I've been working on setting up the environment for this level, as it's supposed to be a bunker which ran out of power. All you have left is enough battery for a flashlight- so you gather your necessities in the light of the flashlight and leave- it's sort of a tutorial. I understand post processing is a lot for the oculus as it isn't a PC, but I still need the lights to pretty much go out, save a rare few.
NVM. I got a nice view now. Sorry if I ask a dozen questions, I'm a bit rusty as I haven't done this in a good while.
Oh well. At least enjoy the little victories in life.
Next up is trying to figure out how to prevent a 3D light from shining through walls. It's dark, as intended, but you can still see light shining through the wall and onto the ceiling. It seems as though I'm going to have to re-create the mesh libs so they recognize where to cast shadows. Back to the old drawing board...
It's still a step up from not even being able to move, or having no control over the environment, although I still can't grab my flashlight- which is the light source here.
On the subject of VR, how does one add points that let you store objects until you have to grab them again? Take Walking Dead: Saints and Sinners, for instance. There's a special place one keeps the flashlight, another for the backpack, and there are two empty ones that you can place weapons in, one on each hand. I'm guessing it has to do with static bodies and triggers, but the holsters have to also follow the player so they are always in the same place as the player's headset rotates. As stated, just a guess. I don't exactly know.
So, in Godot, the pockets you can place around the character to have an inventory are called snap zones. I still don't know how to use them, so I will keep digging.
Just discovered the physics left and right hand in xr tools. I don't know how to swap them for another set of hands yet, but they do bend their four long fingers based on player controls and look better than basic cubes. As simple as they are, they're probably enough for this minimalist game I'm working on right now.
Does anyone else have at least a suggestion on how to use the snap zones, plz?
I can't believe I'm the only one doing VR... It's insanity, I tell ya! 😄
All kidding aside, though, I can't figure everything out on my own. Anyone have at least a course or a video series I should look for? I mean, seriously, I can't be the only VR dev, here.
I came across an error while trying to run the example vr starter project- Initialize- No Libraries set for this platform. What sort of library is it looking for? I tried Oculus Mobile Plugin, but it didn't work.
The VR starter tutorial is looking for OpenVR plugin, which I think was linked in the starter VR tutorial on the Godot 3.1 docs, but I am not totally sure right off. I’m not sure if that is the starter protect you are referring to though.
Yes, that's the one- but I have the complete tutorial. And thanks! That got rid of one error, and now I have this one: Movement_Vignette: no VR interface found!
What could I try here?
I think it takes the same interface as the tutorial, so the OpenVR one. I think that was the only interface at the time. It has been awhile though so I forget, but I think that is what it needs.
I just downloaded that one... Hm, 😕
So OpenXR is the new standard. Before that, you had to use proprietary SDKs from each vendor. These would be included (by default) in Unreal and Unity, which made them easier to work with, which is why most VR developers use one of those engines. In Godot, it was a community effort and not built-in. As of a few months ago, OpenXR was integrated, which makes things much better, but it still doesn't have the high-level components that are used in Unreal/Unity. But all the pieces should be there. Unfortunately, my main machine is on Linux, and the VR support is bad or non-existent (in general, not a Godot thing). I can look into doing a tutorial, I still have a lot of content planned for my site, but I've been falling behind on that due to focusing on other things. I'm finishing school soon, but I also want to contribute to Godot, I have a game I'm starting to work on, plan to start a company, and all sorts of other stuff (while still messing around on the forum all day). So I can't promise when I will get around to it.
I guess I will keep my nose glued to YouTube, then. What I don't get is how some are already building VR games in Godot when the resources are so limited. They're already showcasing stuff.
It would probably be very nice to connect such a controller to a VR helmet. For those who are not jumping around the room, and sits in a comfortable chair.
© 2022 - 2024 — McMap. All rights reserved.