NeoSpark314 / godot_oculus_quest_toolkit

An easy to use VR toolkit for Oculus Quest development using the Godot game engine
MIT License
367 stars 38 forks source link

How can both grabbing and climbing work in the same scene (and how too only climb on certain StaticBody nodes) (and Now "Force Move Up" reacting to everything)? #53

Closed PAG-Studios closed 3 years ago

PAG-Studios commented 3 years ago

Hello! I have recently started VR development, and found your toolkit to be really helpful. I made a test world scene to add the all the VR features, player, RigidBodies, StaticBodies, etc. Everything worked perfectly, except the climbing mechanic. Grabbing objects works by itself. Climbing works by itself. But when I tried adding both mechanics, instead of grabbing and throwing a RigidBody, you climb on a RigidBody while being able to rotate it at the same time. I tried to reprograming a few things, but none of my tries worked. Is there a fix, a workaround, or something I missed? Will there be an update for the toolkit that will fix this issue? Also, is there a way to make the climbing mechanic only work on certain StaticBodies? I tried Groups, Classes, and even attempted to make a custom node. If you answer any of my questions, I'll be really grateful.

PAG-Studios commented 3 years ago

Update: I managed to fix the first issue! Had to rewrite some code. Here is an image of what needed to change:

Godot_Climb_Fix

I don't know if it's the best way, but it works. now I just need to figure out how to get it to only work on certain StaticBodies, whether using groups, classes, or making custom versions of StaticBodies. If there is a more efficient way to rewrite the code, please let me know. Thank you, and have a great day!

NeoSpark314 commented 3 years ago

Hi!; Thanks a lot for you feedback. Always nice to hear from people using parts of the toolkit :-). Right now I don't know if there is a "best" way to do it. So far I did not really combine all the features. I think it would be a good idea if I included such a demo scene in the toolkit at some point to find out about such issues.

Regarding your problem: I think a good way to handle this problem could be by using groups and change the code in both climb and rigid body grab features to only trigger when the object is in the specified group.

PAG-Studios commented 3 years ago

Wow, It worked! Thank you! I thought it wouldn't work, because I already tried it, but it did. It was way easier than I thought.

2021-02-06_12-49-40

Thank you for the wonderful help! This toolkit is really helpful, and you deserve more recognition! Have a great day!

PAG-Studios commented 3 years ago

Hello, again! I now have a similar issue. The "Force Move Up" feature is a great feature, but it reacts to any kind of Body Node. I thought it wasn't a big deal, until this happened:

https://user-images.githubusercontent.com/78623513/107138978-ee50bc00-68e5-11eb-91ab-b283e56ee95f.mp4

Because of this hilarious glitch, I want the "Force Move Up" feature to only work on StaticBody Nodes, but after looking through and rewriting some of the intersept_ray() parts, It just seems I can't find where/what to change. I'm gonna keep looking. If you have an answer, please let me know. thank you, and sorry for bothering you. I hope I'm not annoying.

NeoSpark314 commented 3 years ago

Maybe the ray_collision_mask is what you need here: it is an exported variable here https://github.com/NeoSpark314/godot_oculus_quest_toolkit/blob/aa90f95e16bf14af97a63f17c471d2f45b9cbc18/OQ_Toolkit/OQ_ARVROrigin/scripts/Feature_Falling.gd#L25

It should allow you to use the godot collision layers to define what is colliding with what. But sadly it is exposed just as an INT right now; I think there is a way to make it a bit-mask in the UI... I will see if I can find how to change this; but if you know how bit-masks work you could compute the right number also by and

NeoSpark314 commented 3 years ago

I think I found it in the docs; when you change above mentioned line to

export (int, LAYERS_3D_PHYSICS) var ray_collision_mask = 2147483647;

It will appear as a layer mask editor in the UI; I will push this change also to master.

The documentation about physics layers can be found here: https://docs.godotengine.org/en/stable/tutorials/physics/physics_introduction.html#collision-layers-and-masks

I think this could solve your problem (and is in general a good solution to define what should interact with what)

PAG-Studios commented 3 years ago

Wow, how have I not used this? Thank you! It worked perfectly! I hope you have a Great rest of your day! Again, thank you!