Unity VR Tutorial 2018 - Player movement / fly for Google cardboard

  Рет қаралды 30,008

Xlaugts

Xlaugts

Күн бұрын

This is an Unity VR tutorial for who want's to learn how to make a player walk or fly.
In this video I cover the basics of moving a player by touching the screen, also how to make the player fly.
This video was made in 2018 and as VR still new to work with it may changes over the time how to set up but for now this is working fine, I am being able to create a lot of fun game mechanics using these techniques.
How to set up Unity to work with VR: • Unity VR Tutorial 2018...
Twitter:
Xl...
Instagram:
/ hpirani
Blog : piranigamvedev...
If you have any suggestion for a video or tutorial please leave a comment bellow.

Пікірлер: 99
@sukhjindersingh8762
@sukhjindersingh8762 6 жыл бұрын
hi i have dozens of videoes on youtube for unity. didn't got anyhting but your two videes changed my life.... where were u all the time : )
@xlaugts151
@xlaugts151 6 жыл бұрын
Hey NIT, Thanks very much for the nice words, it's good to know I'm able to help someone. If you need any help let me know :)
@graphicsseion790
@graphicsseion790 4 жыл бұрын
Thanks so much mate, this is the only one tutorial thats explain very simple to move on VR. THANKS!
@thoughtFormMax
@thoughtFormMax 6 жыл бұрын
Very helpful starting point.
@xlaugts151
@xlaugts151 6 жыл бұрын
Thank Max, that's the purpose of this video just give you guys a starting point. :)
@yasminadrianasanchez2415
@yasminadrianasanchez2415 11 ай бұрын
Thank you so much, this help me a lot😊
@markbakker97
@markbakker97 6 жыл бұрын
Very simple script to do VR walk ... thanks for the tutorial!
@xlaugts151
@xlaugts151 6 жыл бұрын
Hi Mark, I'm happy you liked. Thanks for the comment.
@maheshbhegde1099
@maheshbhegde1099 Жыл бұрын
It was very useful for doing a class project. Thank you.
@rajveerjolly7933
@rajveerjolly7933 4 жыл бұрын
Thank you so much for this wonderful tutorial ! I really appreciate it.
@l.xguterres
@l.xguterres 5 жыл бұрын
Obrigada! Ótimo tutorial!
@daniltimofeev6566
@daniltimofeev6566 3 жыл бұрын
Я тоже обрыгался! :)
@Novia5555
@Novia5555 4 жыл бұрын
This is so useful.. please make another video about Google Cardboard or VR on mobile, cz out three lacking this kind of tutorial ...
@GS-ef5ht
@GS-ef5ht 6 жыл бұрын
Very helpful. Thank you!
@xlaugts151
@xlaugts151 6 жыл бұрын
Thanks GS
@Esil__
@Esil__ 5 жыл бұрын
hey my dude to be honest ur tutorial is good for beginner like myself .... if ur not that busy with anything i would like to suggest a popup message if u gaze on a game object for ur next tutorial
@xlaugts151
@xlaugts151 5 жыл бұрын
You mean instead of activating a button, you want a message to pop up on the screen ?
@BlunderBoyNehruJ
@BlunderBoyNehruJ 4 жыл бұрын
@@xlaugts151 yes
@xlaugts151
@xlaugts151 4 жыл бұрын
@@BlunderBoyNehruJ I wrote down that on my list of tutorials to do.
@ajsklandsoftverse_1824
@ajsklandsoftverse_1824 5 жыл бұрын
you are great man
@xlaugts151
@xlaugts151 5 жыл бұрын
Hahaha You are great too!!!
@audacityfilmsproductions5334
@audacityfilmsproductions5334 6 жыл бұрын
I 100% love you! Thank you!!!
@xlaugts151
@xlaugts151 6 жыл бұрын
Thank you! :)
@michaelwilson7159
@michaelwilson7159 6 жыл бұрын
Legend....keep posting
@xlaugts151
@xlaugts151 6 жыл бұрын
Hi Michael, Thank you very much, I now studying a lot and I will bring more videos later about VR. :)
@katalinabiondi
@katalinabiondi 3 жыл бұрын
Brilliant!!
@RFixT_Swaps
@RFixT_Swaps 4 жыл бұрын
I have problens with first code I wrote this in visual studio 2019: using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerWalk : MonoBehaviour { public int playerSpeed; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if (Input.GetButton("Fire1")) { transform.position = transform.position + Camera.main.transform.forward * playerSpeed * Time.deltaTime; } } }
@thedarkshadoww9711
@thedarkshadoww9711 2 жыл бұрын
I know it's been a while since you created this video but I'm would be great if you can help me a problem. The player moves just fine, but I want to have it a little bit of inertia, like keep moving till the button is pressed, and when it's released the player slows down gradually coming to a stop. I cannot work out the logic for this.
@sexypotato
@sexypotato 3 жыл бұрын
Awesome!
@Un_colombiano_en_roma_italia
@Un_colombiano_en_roma_italia 4 жыл бұрын
Te lo voy a decir en español eres el tuyo amo me salvaste de una
@xlaugts151
@xlaugts151 4 жыл бұрын
Gracias my Fried :)
@thetower_
@thetower_ 6 жыл бұрын
subbed, thx for your job
@xlaugts151
@xlaugts151 6 жыл бұрын
Hey Cyborg, Thanks very much! :)
@MaximuszEsala
@MaximuszEsala 5 жыл бұрын
hey man im a newbie your videos helped me alot but im having trouble with moving i get the following error please help !!! A namespace cannot directly contain members such as fields or methods
@xlaugts151
@xlaugts151 5 жыл бұрын
Hey Maximus, This might be happening because of some spelling mistake or some () in a wrong order. Have a look on your script with attention and see if you can spot any small mistake. Thanks for watching my friend :)
@omarkhedr5855
@omarkhedr5855 3 жыл бұрын
Thanks for this video!! What was Fire1 used for?
@damurlive
@damurlive 5 жыл бұрын
When the camera collision with the cube, the camera is fall down, i mean fall on the ground (hope you know what i mean), and sometimes when i walking and turn right of left, the cameras also fall too ... How to fix it ?? Thank you 🤗🤗🤗
@xlaugts151
@xlaugts151 5 жыл бұрын
Hey Cops, That might be happening because of the rigibody of your player. You see that the rigibody has a constraints options that you can freeze the rotation of your character. Try to do that do some tests and let me know if that wokred. Thanks for watching :)
@damurlive
@damurlive 5 жыл бұрын
@@xlaugts151 haha ... I'm forget to check freeze rotation and it fix now ... Thanks 👍👍👍
@ELPIRATATUQUE
@ELPIRATATUQUE 5 жыл бұрын
I'm trying to code a reverse button but not getting the "if" "else" part right, any ideas? Everything else worked like a charm :)
@xlaugts151
@xlaugts151 5 жыл бұрын
Hi Reinaldo, Sorry for the delay I took some days off for the holidays. Could you share a bit more details how are you doing that ? Maybe I could help. The reverse button you added is to make the player walk backwards is it ?
@ivanmurataya4017
@ivanmurataya4017 5 жыл бұрын
Do you have an app on the playStore, I would like to se a complete VR app :) Great Job! you are helping me a lot!
@xlaugts151
@xlaugts151 5 жыл бұрын
Hi Ivan, I don't have one. I actually just finished one VR game with these mechanics to grab and release but I'm delaying to publish. Not sure why hahaha but soon I will release it. It's very simple one. I will let you know once I publish and thanks for asking. Im happy to help by the way!
@alexdiamantis9141
@alexdiamantis9141 5 жыл бұрын
Ok so since this is for an Android phone/device, how would a person interact with the controls u show? There is no mouse to click on a phone ect ect
@xlaugts151
@xlaugts151 5 жыл бұрын
Hey Alex, Good question, the mouse on phone device works as touch screen. So when I use it to interact is the same as someone using the touchscreen and the gooogle cardboard has that on the side.
@domenicolopez6114
@domenicolopez6114 4 жыл бұрын
Hi mate, great video.
@georgemarneras7588
@georgemarneras7588 4 жыл бұрын
Newbie here. I used the script but there's an error "The name 'input' does not exist in the current context". What should I do?
@peterquill726
@peterquill726 6 жыл бұрын
Hi, can I move player using Unity timeline instead? I don't need any input just want the player to move along position I've key-framed.
@abhijitbhushan
@abhijitbhushan 5 жыл бұрын
I don't want it to move when the reticle pointer is pointed at something. Could you help me with that? Right now, I've got a panel on which a button needs to be pressed to change the scene. But it still moves a tiny bit when the button is pressed, how can I avoid this? Really appreciate the video, saved me a lot of time and energy, thanks!
@xlaugts151
@xlaugts151 5 жыл бұрын
Hey friend, sorry for the delay. Could you provide me a bit more details about what are your trying to do ? You dont want the player to move when you point at something is it ? Let me see if I understood right, you want your player to autowalk and if you point at something stops ??? Sorry if I got it wrong. Cheers
@abhijitbhushan
@abhijitbhushan 5 жыл бұрын
@@xlaugts151 Not exactly, so right now, when I press the button on google cardboard the player moves. But suppose I have a button in my VR scene which the player needs to press to change the scene. When the reticle pointer is aimed at this button, it changes from a dot to a circle, yeah? This is when I don't want any movement when I press the google cardboard button. The movement functionality should be turned off when the reticle pointer is a circle. I hope you understood, thanks for your reply!
@abhijitbhushan
@abhijitbhushan 5 жыл бұрын
In your above video, when you look at the cube and press the button, the player moves a tiny bit, I don't want that to happen. Is there any way to prevent this? The cube should be changing the direction of rotation without the player moving. Thanks!
@xlaugts151
@xlaugts151 5 жыл бұрын
@@abhijitbhushan I finally got it what you mean, yeah there is a way I just don't know yet hahahaha. I'm going to make some test and I let you know, I have some idea how to do it I think, basically what I am thinking is if the player looks at the button or object they want to interact we could have a bool variable that will deactivate the walking system and once he stops looking it activates again. I'm not sure if is going to work but I let you know later on ok ?
@xlaugts151
@xlaugts151 5 жыл бұрын
@@abhijitbhushan I found a solution: public float playerSpeed; public bool canWalk = true; // Update is called once per frame void Update() { if (Input.GetButton("Fire1") && canWalk) { transform.position = transform.position + Camera.main.transform.forward * playerSpeed * Time.deltaTime; } } public void CanWalk() { canWalk = true; } public void CantWalk() { canWalk = false; } I created a variable "canWalk" that needs to be true for the player to be able to walk. If you look let's say to the cube for example, the cube has that component event Trigger you can use pointer enter and exit to call those two methods, so if your player is looking at the cube it will call CantWalk() and the bool is going to be false disabling the movement and on pointer exit you call CanWalk() enabling the movement again. Let me know if that works
@niharmamidipudi1029
@niharmamidipudi1029 6 жыл бұрын
Thank you very much for this video. I am having some build issues with unity 3d on my laptop is there anyway I can contact you for help
@xlaugts151
@xlaugts151 6 жыл бұрын
Hi Nihar, Yes, what's the issue you're having now ? Thanks
@visni643
@visni643 4 жыл бұрын
hey man, i can't solve the problem of flying, in my game i shouldn't fly, but because of the script i can
@zhyli1451
@zhyli1451 5 жыл бұрын
Very helpful and clear guide! But I have a problem here, it works well in my Game view, however on my phone the player can't walk, I just have a 360 view but not walking any more. Do you know what happens?
@xlaugts151
@xlaugts151 5 жыл бұрын
Hey Zhy, How are you doing to move ? Touching the screen ? There is also one problem with the latest version of the SDK the onClick is not working but I am not sure if that's your case. Let me know how are you doing to get the input, because in the video I use Fire1 which is the same as touching the screen. Thank you for Watching :)
@damurlive
@damurlive 5 жыл бұрын
This problem also happen to me too .. I can't move on android, and i use your code with "Fire1" ... Can you help us ???
@xlaugts151
@xlaugts151 5 жыл бұрын
@@damurlive That problem might be happening because of the SDK but I have to do some test and I will let you know guys
@monamoinipour8975
@monamoinipour8975 4 жыл бұрын
Thank you it works out! I just have one problem that I cannot fix, but maybe you (or someone else) can help me: The player walks in every direction you look, which is fine, but he also walks through the floor and other objects too. He basically walks everywhere (and through everything) you look at. Any ideas how to fix this? :D
@feelreality1273
@feelreality1273 4 жыл бұрын
Omg I've the same issue, do you have a solution for this?
@sarojrani5916
@sarojrani5916 2 жыл бұрын
@@feelreality1273 you should make evry object a physics object or your player a physics object 🗿or I am wrong i think
@tuguldurjigjidsuren391
@tuguldurjigjidsuren391 5 жыл бұрын
Code is not working for me some reason. It's keep giving me nullreferenceexpection error. do you know about this problem? (Code is exactly the match)
@xlaugts151
@xlaugts151 5 жыл бұрын
Hi Adventure, If you double click it is showing any part of your script that is giving the error ???
@tuguldurjigjidsuren391
@tuguldurjigjidsuren391 5 жыл бұрын
@@xlaugts151 I double clicked it and it takes me to the transform.position =transform.position + Camera.main.transform.forward * speed * Time.deltaTime part
@xlaugts151
@xlaugts151 5 жыл бұрын
@@tuguldurjigjidsuren391 Check if the camera that's inside the player has the tag MainCamera, that could be the error.
@alKihuri
@alKihuri 4 жыл бұрын
Thank you)
@Jusete2
@Jusete2 6 жыл бұрын
Awesome tutorial, but there is a problem: How can I push the button when app is in mobile cardboard? is it possible? Thanks, I like so much your work .
@xlaugts151
@xlaugts151 6 жыл бұрын
Hi Jose, Oh thanks for your comment, I'm not sure if I understood right, but if you asking about how to push the button when the app is on the phone, you just touch the screen and it will change the rotation. Let me know if I got it right or not hahaha. Thanks :)
@Jusete2
@Jusete2 6 жыл бұрын
Hi again! Thanks for write me. void Update () { if (Camera.main.transform.localRotation.x > 0.0f) { transform.position = transform.position + Camera.main.transform.forward * playerSpeed * Time.deltaTime; } } If you watch down the player will move. Do you like? it is so simple but may be a temporal solution for a easy game. Thanks again for your tutorials.
@xlaugts151
@xlaugts151 6 жыл бұрын
Hi Jose, Yes this also works, it will make the player walk automatic, or you can just leave like that: void Update () { transform.position = transform.position + Camera.main.transform.forward * playerSpeed * Time.deltaTime; } Let's say you want to make the player walk when it looks down you could do like this: public float walkAngle = 30.0f; // Angle that will make the player start walking public float playerSpeed; public Transform cam; // Don't forget to assign the main camera to this variable on the inspector // Update is called once per frame void Update () { if(cam.eulerAngles.x >= walkAngle) { transform.position = transform.position + Camera.main.transform.forward * playerSpeed * Time.deltaTime; } } So every time the player looks 30.0 degrees down it will move foward
@Jusete2
@Jusete2 6 жыл бұрын
Fantastic, It is better. (eulerAngles) Thanks!
@xlaugts151
@xlaugts151 6 жыл бұрын
You're welcome :)
@josepholiverquesada2041
@josepholiverquesada2041 5 жыл бұрын
how am I able to walk using vr remote(joystick)
@xlaugts151
@xlaugts151 5 жыл бұрын
Hi Joseph, Thanks for asking, I'm creating a tutorial about that. There are a lot of people asking me about it, could you let me know which controller are you trying to use ? This will help me to find a solution for it. Thanks :)
@harletperniaespinoza9364
@harletperniaespinoza9364 5 жыл бұрын
@@xlaugts151VR Box , please
@xlaugts151
@xlaugts151 5 жыл бұрын
@@harletperniaespinoza9364 I will release one this week
@xlaugts151
@xlaugts151 5 жыл бұрын
Hi @@harletperniaespinoza9364 I released a tutorial showing the movement with controller: kzbin.info/www/bejne/i3PSqKR9l79sl5Y Let me know if that worked for you please. :) I hope you enjoy
@josepholiverquesada2041
@josepholiverquesada2041 5 жыл бұрын
@@xlaugts151 Thank you so much! best tutorial for VR player movement. code efficient. 👌🏻
@alexsafayan7684
@alexsafayan7684 6 жыл бұрын
The mic isn't the best, but good tutorial!
@xlaugts151
@xlaugts151 6 жыл бұрын
Hi Alex, Thanks for your comment, yes know my mic is definitively not the best hahaha... but I wanted to see if I could make some videos before buying the a better one. I will soon I feel that I need at least a decent one.
@djwosa2000
@djwosa2000 5 жыл бұрын
Thanks
@AnnaConstantinova
@AnnaConstantinova 5 жыл бұрын
My player is not able to move forward with script... help!
@xlaugts151
@xlaugts151 5 жыл бұрын
Hi Anna, Could you share you script for me to have a look?? Also could you let me know if there is any error showing ?? Thank you for watching :)
@AnnaConstantinova
@AnnaConstantinova 5 жыл бұрын
@@xlaugts151 Thank you so much for the reply! I have Mac and free version of Unity. (I don't know if it matters but I didn't import x86 and Mac in Google VR package like in your tutorial.) Error message: "Virtual Reality SDK Cardboard is not supported in Editor Play Mode. Please Build and run on a supported target device. Will attempt to enable None instead." Here is my script: using System.Collections.Generic; using UnityEngine; public class PlayerWalk : MonoBehaviour { public int playerSpeed; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (Input.GetButton("Fire1")) { transform.position = transform.position + Camera.main.transform.forward * playerSpeed * Time.deltaTime; } } }
@0369500
@0369500 5 жыл бұрын
@@AnnaConstantinova You code seems to be right. By the message Unity is showing it might be something with a Unity not recognizing the SDK version I found a article that might help you to solve the problems: stackoverflow.com/questions/44774254/unity-vrdevice-cardboard-not-supported-in-editor-mode-please-run-on-target-dev You could also watch the video on how to create your first VR app and see if the settings are ok.
@RFixT_Swaps
@RFixT_Swaps 4 жыл бұрын
Its not work in unity I will test it in phone
ПРИКОЛЫ НАД БРАТОМ #shorts
00:23
Паша Осадчий
Рет қаралды 5 МЛН
小丑在游泳池做什么#short #angel #clown
00:13
Super Beauty team
Рет қаралды 42 МЛН
这三姐弟太会藏了!#小丑#天使#路飞#家庭#搞笑
00:24
家庭搞笑日记
Рет қаралды 126 МЛН
Unity VR Tutorial - Button Gaze Timer Interaction
7:20
Xlaugts
Рет қаралды 20 М.
Realidad Virtual Google Cardboard Tutorial Unity - Configuración
10:49
I Made the Same Game in 8 Engines
12:34
Emeral
Рет қаралды 4,1 МЛН
10 Minutes vs. 10 Years of Animation
19:29
Isto Inc.
Рет қаралды 970 М.
Training AI Bots to Fight (they started dancing)
15:06
cozmouz
Рет қаралды 275 М.
I Paid Fiverr Game Developers to Make the Same Game
10:25
BadGameDev
Рет қаралды 695 М.
Walking in unity google cardbord vr with gamepad.
20:06
xrsarajevo
Рет қаралды 14 М.
VFX Artist Reveals the True Scale of Minecraft
14:28
Corridor Crew
Рет қаралды 1,8 МЛН
ПРИКОЛЫ НАД БРАТОМ #shorts
00:23
Паша Осадчий
Рет қаралды 5 МЛН