Make Gorilla Tag Movement in Unity VR
Vložit
- čas přidán 30. 06. 2024
- Ok, I honestly had WAY more fun making this tutorial than I should have. This kind of movement is so addicting. In this video I use a basic PID controller and Hooke's Law to add Gorilla Tag's physics based movement to our Unity VR project. Run, climb, and launch your way around in this new Unity XR tutorial! We're using Unity 2021.2.7f1 and the XR Interaction Toolkit as well.
🔗 Also check out @DonionTech. I used some of his videos about physics climbing and how to improve climbing when piecing together this tutorial.
Physically Accurate Climbing: • How I Created Gorilla ...
Improve Climbing: • 3 Tips to Instantly Im...
🦍 Gorilla Tag's Actual Movement Source Code
github.com/Another-Axiom/Gori...
🎮 Gorilla Tag on the Oculus Store
www.oculus.com/experiences/qu...
📺 Watch Next: • What Do I Need to Beco...
🥽 Enroll in the (now FREE) VR Creator Academy: skool.com/vrcreatoracademy
⌚ Timestamps
0:00 Intro
0:39 New Unity Hub version 3.0.0
1:36 Setting Unity up for VR
3:51 PID Controllers and Hooke's Law
5:15 Setting the scene
8:20 PID Code
14:11 Hooke's Law code
22:13 A more interesting scene
25:09 Subscribe!
Sharing VR tips to help you create that Virtual Reality game faster than you thought possible!
Thanks for making so many and up to date videos! With VR and Unity changing every week it's super helpful to have up to date videos instead of figuring out "Ok so did they mean XR Origin or XR Origin Action Based?"
Glad to help!
a multiplayer tutorial would be amazing. Thank you so much for the tutorial.
It's in the works!
Just spent a week on making my own loco motion. THEN THIS! Thanks so much!
Glad I could help!
If there's one thing I've noticed in gorilla tag, it's the potential-to-output ratio. Gorilla tag mechanically feels like it could do so much more, whether it's a banjo-kazooie/donkey Kong64 campaign, adding more mechanics like interactibles(ropes, throwing rocks), collectibles(bananas, powerups), environmental hazards(ice, rising lava) objectives(tag CTF, all vs one), challenges(survive for x minutes to get y shiny rocks, tag x people to get y shiny rocks
Ooh here's one: what if you were a robot, and you could decide how your body is setup? You could have tank treads, spider legs, classic 2 legs, or heck go legless and gorilla tag hop around. Maybe being small could get you in hard to reach places
For real! It's just an movement mechanic. You could easly scale it up to a full-blown game with more mechanics and stuff
I'm sure that'd be a great separate game, but part of what makes gorilla tag so great is its simplicity. It's essentially a blank sheet of paper, and we are the crayons.
This is a very eye opening video :) I wasted a lot of time trying to use physics joints for hands but they usually produce jittery results. I think your approach is much more stable! I will give that a try
You're very welcome!
This tutorial came at the right time for me!
Just last week I was trying to create a physics based character controller in Zero G and wasn't really successful, this will definitely be a great starting point !
Thank you :)
This system would work perfect for that! Just add in a grabbing mechanic that adds a fixed joint wherever you grab and you'll be set!
A continued version of this adding multiplayer would be amazing. Really want to play my own game with my friends.
Great idea!
use photon
@@databsoluteunitno normcore is live is love is life
@@alexstuf3 gorilla tag uses photon
@@alexstuf3 photon is very very powerful you can have photon Vr package as well and make amazing powerful networked games I have made plenty of multiplayer games using photon
Please, I would love to watch a bigger tutorial 😉 Thanks!!
You got it!
OMFG I HAVE BEEN LOOKING FOR THIS THANK YOU!
You're welcome!!
This video is truly amazing, you can make a good gorilla tag game within hours people! Amazing work from a mastermind that my tiny brain can't comprehend. 👍
Glad you enjoyed it!
Can't wait I've been needing this for a game I've been making
Perfect!
Same brother, it should be the vr standard imo
im trying to make a playground for me, and this helped A LOT thank u! :D
No problem!!
Thank you so much, gorilla tag is my favourite game and I always wanted to make a game like it!
Same.
im going to love this. ive been thinking of testing an environment i was plannign to make with no skills at all inspired by gorilla tag with a "booster jet" trigger
Ooo super cool!
I can finally use gorilla tag movement in my game! I wanted to do this for a long time and I want to see more videos on it like the tag feature and multiplayer. That will keep me very interested
bro there is a unity package for movement
@@twist474 i didn't know
Have you considered looking into physics weighted objects in vr? Would be cool to have a sword which you could only vield with two hands and player wouldn't be able to lift it properly with one hand. Or have an strenght attribute to determine on how well the player can lift different weighted objects. In vr it would be possible to combine actual exercise tasks to gain strenght points to vield heavier weapons in some rpg vr game etc.
You could totally adapt this system to that concept! That’s a great idea
Thanks for your videos they are very helpfull in VR development
hi, appreciate your efforts towards your videos brother, one thing i would like to ask can you make a beginner series to get started with C# and unity, to get comfortable with it. Also can you make a tutorial for creating a kind of a tag game in vr? I want to know the physics and the structure of the code, for example when the player will touch the other player, he will become the tagger.
Absolutely! I'm actually planning on doing both early this year!
really awesome thanks a lot !!!!
Last year I spent several months trying to make Gorilla Tag's movement work with rigidbodies, finally giving up after a dozen of iterations
I am very much a hobbyist and knows very little about physics and their simulation, so I accepted it as something I couldn't figure out how to do and that it was simply a good learning experience, feeling a little defeated
Today I find this tutorial and can finally put the missing pieces of the puzzle together!
So I felt compelled to make this comment to express my thanks, you couldn't imagine how happy I am to have found this!! Thank you so much!
can you maybe paste PID Code here?
@@lucrr7650 plz
@@yeetmastervr I don’t have it
Amazing! Best of luck in your future projects!
Really helped me out! Although this did take me forever for the scripting, I made a very cool game!
I'd be excited to see it! Share your progress in the discord!
@@JustinPBarnett Also I was testing the game and the hands would just fly everywhere! Do you know how to fix this?
Thank you for tutorial thats the best part thank so much fun🌺
make sure to note that when you need to install DEFAULT INPUT ACTIONS, it is now called STARTER TOOLKIT
Great. As always. Maybe it's time for a movement tutorial like "Moss" or "Lucky's Tale"?
Great suggestion!
Thank you i'm waiting for that. 👌
👍👍
Great! Similar system.. if not better than my game. SIDE NOTE sick style, my flat is grey and warmly lit.. used to rock a goatee as well plus both VR unity tutorial people (me not so much) awesome shit man look forward to seeing more
Thanks!!
You were born to be a teacher - Great timing of presentation with just the right level of detail to make the learning fun and adding the formula source info was perfect. Thanks - at some point could you take us through the steps to publish a project to the point of being able to share the APK file with another user like a family member that has a Quest 2 [my kids have them] so I could share a game I made? - thanks
Thanks so much! I really appreciate your feedback. And yes that's a great idea! I'll definitely make a video about that!
How was he born a teacher? None of this works, he goes way to fast and gives people no time to catch up, and on top of that, randomly cuts with no explanation why and moves on, leaving me confused and sad because I wanted to make a game and got a shitty teacher.
@@trollinsky6700 you know you can pause, right?
@@trollinsky6700 yes you can pause
@@JustinPBarnett I know, but the moment I unpause for two seconds, your already half way through the video
Thank you sooo much I've been trying to find some
You're welcome!
Enjoyed this tutorial, though I found that having the capsule collider on the Camera and rigidbody on the XR origin meant my head position was unable to track on the Y axis, which could lead to nausea.
This doesn't happen with a character controller but obviously the rigidbody is needed for the PID calculations.
Ah good point. Might have to be tweaked if putting this into an actual game.
Yessir i asjed for it and its here thanks
Absolutely!
Great video not only for gorilla tag movement but also simple VR physics hands. Ive been making a ping-pong type game in VR and have struggled to get paddles with a rigidbody to work right. Watching up until 14 minutes got me the results I wanted, those PID equations are definetely the way to go for this use case.
Everyone, if you're having trouble with the hands not showing up make sure to go to your right hand and left hand controllers and make sure the references are set to either left hand or right hand, hope this helps
Cool, i will have to try this out tonight. strange i was looking for something almost identical to this just the other day. Looks easy enough to modify so friction or drag is increased when grabbing? that would be a more realistic effect instead of just sticking to everything. at least thats what i was looking for a grab and move mechanic. Keep it up.
Yea you can modify the friction to go with speed too!
@@JustinPBarnett so it looks like your latest video added a grab mechanic. nice. so i added that to it. Was wondering. before i swap blocks with actual hands. how do i keep them to stay realistic rotation. currently when i press down on the ground the blocks will rotate like crazy. is this is a friction settings. i kind of want the hand to lock rotation once it pushes against something. Otherwise i can see real hands looking super strange doing 360's while i press on the ground.
@@pRoFlT you could try increasing the mass of the hands
I love this tutorial one thing I want to do is make an avatar for this game can you maybe give us the basic rundown on how to make an avatar for game mechanics like this?
Yea that's a great idea for a video!
Great tutorial! it helped me a lot! How can i implement snap turning with the left stick? (if i try to implement it it becomes very glitchy and it doesn't work) Ty again!
this tutorial is wonderful, but when i ran the game the hands were like if they were attached to the worlds thinnest spring, so i was wondering what variables i need to reduce or modfy in order to get them to not accedentaly rip a hole in spacetime? i'd love to see your suggestions!
This truly is a fun little project to play with. What a great way to start a new year with some Unity VR goodness.
Couldn't agree more!
In the PID code part of the tutorial when I save I get an error saying the rigidbody does not contain a definition for AddTorgue
Check your spelling
Great Tutorial!
19 minutes into the video you want to limit the drag, it's a common problem in game programming, so unity has a method already for it:
var clampedValue = Mathf.Clamp(originalValue, min, max);
(you even say in the video that you want to clamp the value 🙂 )
I tried that and it was saying clamp wasn’t recognized for some reason
This is the video I've been waiting for MY ENTIRE F**KING LIFE
🙌🦍
I made a little game out of the open source movement but had to jump through the hoops of old versions and deprecated packages to get it to work. Might be the fact that it was my first game but it was really buggy when it came to adding turning and haptics.
You'll get it worked out!
@@JustinPBarnett :)
@@TroutVR aha now i know how you made your game.
@@limish lmao yes
@@TroutVR I’ll give you props as I could barely even follow this tutorial
Thats good but can you try to make some dynamic hitsounds? Ive been trying to figure that out for a while
Thank you always 👍 great
Always welcome
Please make a video about, how to create a new project for Oculus Quest with Application Spacewarp support for more frames in standalone VR.
What’s application spacewarp?
ty so much i cant wait to see what i can make with this
😄😄😄😄😄😄😄
Best of luck!
hey so i downloaded the unity package in your patreon and im having 2 issues. The first one is that when i get into VR it feels like its my normal height irl so its pretty hard to touch the ground and the second issue is that even though i used the exact script from the unity package, i cant move around with my hands. Other than that great tutorial and thanks a bunch for making it!
First issue is easy, just decrease the height of the capsule collider on the camera. For the second one, did you increase the mass of the hands?
THANK YOU SO MUCH
You’re welcome!
We should make a multiplayer tutorial to help make it be a kind of community game for people to hop in to communicate with friends.
That's one of my goals early this year!
@@JustinPBarnett Also I am having an issue where when I playtest, its a black screen in my quest and nothings happening on the play screen. What do I do?
can you please do a full gorilla tag tutorial!
Would be curious to know how to make a non physic movement based on controllers speed (fake sprinting with hands to sprint in game).
Good idea!
Could you make a tutorial on how to get the input from controller buttons? I’m on oculus and I want to know how to get the A, B, X and Y input.
I did an input tutorial! Check that one out. Or maybe the jump tutorial would help with that too
@@JustinPBarnett ok, thank you
When adding the XROrigin to the rigid body on the Physicshand script there is no slot to put in the XROrigin
this is a great tutorial but i am having a lot of trouble doing this is august of 2022 and i’m very confused on what your doing is there any way you could help?
after many failed attempts I finally got it. legend
Amazing! Way to stick with it
For every new project do you need to install the packages in your settings 📦 every time or are they set once you have done them?
Every time... or you can make a basic project and copy and paste that one for new projects
Nearly broke my finger on my desk, it still stings and is kinda numb.. 10/10 :)
hahaha too realistic then? :p
what values would you change if you wanted to make jumping high very difficult ( a large push results in not much of a upwards movement
Just decrease the force values!
I'd love to see how you conquer completing a full clone.
I think that'd be super fun!
@@JustinPBarnett please do it!
yea
I’m not sure if you’ll be able to do this but if you can could you make a tutorial on how make a vr platformer like Lucky’s Tale or Ven VR Adventure?
I should probably play them first 😅
Please do a multiplayer tutorial
Also anyone got any ideas for games using this tutorial?
Download the project here: shop.justinpbarnett.com/products/gorilla-tag-movement
Isn't 2020.3.25f1 the newest released version??? Now I'm confused.
@@servanttofriend8481 nope! We’re on 2021.2.7 now
@@JustinPBarnett you sure buddy? Because the newest one is the 2020 one
@@trollinsky6700 it’s 2021.2.10f1 now
Where do you copy
and paste the code?
Hey i have been tring to figure out what the problem is but the hands just keep getting luanched super sonic and never come back
Everything works! However, my player is very bouncy. Is there anyway to make my player less bouncy?
I'm starting a project with a climbing mechanic being the main gameplay feature. Think you could potentially do a tutorial on climbing in the future? Thanks!
Check out the livestream I did on this subject! I hit on grab climbing later in the video!
@@JustinPBarnett I'm not using physics-based hands, so the climbing won't work for me.
@@bren4409 hmmm that’ll be a totally different tutorial then
Would it be possible to add a dash based on camera rotation and directional input (from left stick)? Like if you were to look up and press forward you would launch upwards, or look forward and hit left to dash back etc. ? The math and coding sound possible but how would you do that
Edit: im trying to do it in Unity C#
Absolutely! The easiest way might be to add a ForceMode.Impulse to the player's rigidbody in the direction of the player's head. Just need to subscribe to the thumbstick's movement
@@JustinPBarnett Hey Justin! I appreciate you taking time to answer my question. However part of the problem i am having is that the rigid body is attached to the XRrig which is the parent for the gorilla tag type movement that I have and the camera is seperate and the child. so ForceMode.Impulse isnt working with the cameras rotation and the coordinates of the stick. would it involve Quaternion math at all to judge the position of the camera and the stick input? ive been working on this for a while and i get confused easily.
Edit: also what do you mean by subscribe to the thumb stick movement? Again, i am confused easily.
where can i copy and paste the pid controller code iv looked on the wiki page and i cant find it please help
YOU DID IT!!!
Did what? lol
@@JustinPBarnett remember when I said could you please make gorilla tag locomotion tutorial
Gotta love it when tutorials have things that don't appear in the actual process of doing them. Whelp time to find another tutorial.
pls more gorilla tag tutorials
sorry to ask @Justin P Barnett but once i did the pid code i did not get any of the othre boxes in the left or right hand
If you're still having issues join the Discord and we can help you troubleshoot in #dev-help!
Why do you recomend URP for VR? I've had a bad experience with URP performance and had to switch to standard , can you make a video about it?
URP can be scaled up or down a lot better than the standard pipeline. It's designed to be extremely lightweight for mobile devices (which VR fall under with the current state of performance)
Hey! Quick question! How do I learn to program/code like you? How did you learn? Any suggestions? I'm trying to get into game making.
Brackey's CZcams channel has a really good series about learning to code with C#!
@@JustinPBarnett Thanks! Also, do you know why some of the code I type isn't the same color as yours? its usually white for most of the code. I cant get it to work because of it
@@JustinPBarnett does it work with a rift s?
can you make a video on how to make a multiplayer game with this movement i have the move ment down i just dont know how to make it multiplayer
Multiplayer video coming in the next few weeks!!
5:40 while i was looking for shader graph i saw a couple of options but couldn't find the same one. what can i do? thank you
Oh I accidentally cut a bit too much off! I just did Create > Material. Not Shadar graph. Sorry!
can i have some help at the start of the tut when i put the hands as the player thing they went invisible how do i fix it?
If you're still having some issues, ask in the #dev-help channel of the discord and we can help you troubleshoot!
whenver i play my hands just disapear and fly across the map?!
i need help with something, when i try swing far and forwards it brings me back cause 1 the hands go flat when u place them on the floor (how stop) and when i fling far i bring my hand back what stops me from going far cause its touching the ground making contact and stopping me moving
Join the discord if you're still having issues and we can help you troubleshoot!
Sweet! Now show us how to make multiplayer.
That's the plan!
The code isn't working for me. I Put the script in a new folder in assets and copied the script and revised it many times and it wont work. What do i do?
This did not work for me, I love the tutorial but I got stuck on the PID code, nothing would work. I do not know what is wrong. The colors are not there and it says error in unity. I am using the exact same thing as you :((
Will be possible to create an offset between the mesh to jump and the vr hand? In order to have longer arms
Probably you would make the center of the controller mesh pretty far away from the actuall hand mesh. IDK though
Is anyone having an issue with flying 1000 feet in the air when you first put on the headset? I thought it might have been something to do with the hands/ origin snapping into position when the headset is activated, and this being interpreted as a very large velocity between frames. I tried ignoring the first position change calculation, and I moved my origin/ hands away from any collision meshes at the start, but can't seem to figure out what's causing it.
in the start method, try setting the transform.position of the physics hands to the transform.position of the controllers. That should prevent any weird behavior on start
@Justin P Barnett what do I copy from the PID Formula??
Would you be able to make a tutorial on making a VR player model from scratch?
That's a great idea!
So I have just tried to follow the tutorial and for some reason the hands do not move at all and are locked in place. The controllers seem to be giving no input? Any ideas? Also thanks for the great content :)
Did you add an Input Action Manager to your scene?
is there anyway to do movement with hands like in this tutorial but still move normally with locomotion using joysticks
like have this movement for parkour but walk normally with the continuous move
Yes absolutely! Just add the normal continuous locomotion or teleportation movement like you normally would
I am stuck at PID controllers because i keep getting 2 errors in the same line of code
float kdg = (kd + kp * Time.fixedDeltaTime) * g;
i don't understand what I'm missing but I keep getting the error CS1525 for invalid expression term 'float'
and CS1002 because I'm missing a semi colin
how do i make it so i can move my player around but with not my hands but an object attached to my hands?
The developer made the movement open source, but it's still good to learn how to do it from scratch
where can I find that?
@@rassesoderberg7149 I think you should be able to find it in the discord server
I don't remember using it, but I know for a fact Lemming made (or at least planned to make) the movement open source
I actually did NOT know that before making this video 😅 The method I use is much simpler actually after looking over the code. I added the OG code to the description though (let me know if that's not the right file). Thanks for the heads up.
Im quite confused at 6:45, what scripts are you using?
Edit: sorry I meant by the code in the script
The one we created! PhysicsHand.cs
Wondering were did you get the code for the pid? i cant find it on the wiki
The wiki just has the formula. Check out the videos referenced in the description
if I add a capsule collider to the main camera would that stop me from going through the terrain that I make and make me walk over top of the train
Yes!
I added a capsule collider to the main camera and it didn't seem to work for me I also tried to add a capsule collider to the XR rig into the other camera for some reason I still walk through stuff is there somewhere that I can get an asset that just does the code for me????? If there's anything you can do to help me I really appreciate it thank you for all the information that you give us your video is what got me inspired to make my own game and I've made three now successfully and it's really fun I just wish I could climb the mountains or not go through them at least
@@VRplay86 you have a rigidbody on the XR origin?
@@JustinPBarnett no I put a capsule collider on the XR rig I also put it on the main camera like you said. Sorry for asking about such simple things probably but I am not a computer programmer I just literally got my first computer two days ago after watching your video on how to make a game so I am definitely a noob sorry. But thanks for any help that you can give me 😊
Hi your tutorial is awesome! but i got a problem and i dont know how to solve it... when i start the game the controllers(cheese slices) just stay on one place and dont move..
If you're still having issues join the Discord and we can help you troubleshoot in #dev-help!
Is there a way I can copy and paste the script as well? I don’t have the right time to type it all
I can’t find the “Default Input Actions” Sample
I cant figure out how to get to the pic coding part because you didn’t show us just cut it can you explain?
What part?
Hello again so my vr hands keep spinning, do you know how to fix that? No one in the discord seems to be helping me...
Did you make sure to add the right values to the rotation variables? Maybe try increasing angular drag
I have another question, how would you make it to where when you land on the ground that you don’t bounce and you are stable?
Same
Hmmm I'd try messing around with the drag. I think increasing it would help that.
@@JustinPBarnett i tried a different way to do drag and that helped
@@gamer-qd6cg what did you do? I have the same problem with the bouncing
If you want this to work on quest do you need to go to the android tab? (Quest apps run on apks)
Hey so I got it done but it flings me around everywhere like glitched out and flings me when my controllers touch and randomly does it do you know how I could fix it
So I can fix it