How to Make a VR Game in Unity 2022 - PART 5 - Hover, Grab and Use Interactable

preview_player
Показать описание
The fifth episode of the tutorial series that will teach you everything about VR interaction.

····················································································

❗❗❗ WISHLIST MY FIRST VR GAME ON STEAM ❗❗❗

····················································································

📝Best VR Assets ( These links are Affiliate links which means it costs the same to you and I get a small commission. Thanks for your support!)

VR Interaction Framework

Hexabody (Physics VR Player)

Mirror and Reflection for VR

Auto Hand (automatic hand grab pose)

Hurricane VR (vr physics interaction)

3d Hand Model for VR

····················································································

····················································································

If you enjoyed this video, here are some other really good channel you should appreciate :

⌨️ Game Dev

👨‍🎓 Vr Dev

····················································································

00:00 Intro
00:33 Teleportation Fixed
01:30 Interactable vs Interactor
01:51 XR Direct Interactor
02:25 XR Simple Interactable
05:16 XR Grab Interactable
07:17 Attach Transform
09:17 Firing a Bullet
12:43 Bug Teleportation
13:59 Bug Character Controller
15:13 Outro

#vr #vrdev #madewithunity #valem #unity
Рекомендации по теме
Комментарии
Автор

No cubes were harmed in the making of this video.

ValemTutorials
Автор

Loving this series, it's been an absolute god send for me

givemepen
Автор

Script for the gun (make sure the name of the script is the same as the name in the video):


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using

public class FireBulletOnActivate : MonoBehaviour
{
public GameObject bullet;
public Transform spawnPoint;
public float fireSpeed = 20;

// Start is called before the first frame update
void Start()
{
XRGrabInteractable grabbable =

}

// Update is called once per frame
void Update()
{

}

public void FireBullet(ActivateEventArgs arg)
{
GameObject spawnedBullet = Instantiate(bullet);
= spawnPoint.position;
= spawnPoint.forward * fireSpeed;
Destroy(spawnedBullet, 5);
}
}

SSnapse
Автор

If anyone is having trouble with their gloves not picking up/selecting anything- make sure to check off the "Is Trigger" box on each of your gloves! Took me four hours to figure that out

SoundEffekts
Автор

If attach transform is not working for you:

go to the game object who's attach transform you'd like to manipulate during runtime
add an XR Single Grab Free Transformer component to it
inside your XR Grab Interactable component, scroll to the bottom until you see Grab Transformers Configuration and expand it
add an item to the Single Grab Transformers list and drag the XR Single Grab Free Transformer component you just added to that new empty slot
run the game and manipulate the attach point to your liking
you can then reverse all of this to get things back to "normal"
was driving me nuts as well, hope this helps, good luck!

AriyaBayat
Автор

Great series Valem! Thanks so much for this new course. :) Super cool you're sponsored by Unity!

petermcrory
Автор

I am glad you fixed the collision bug at the end because I knew it was going to be a problem as I have dealt with it before and wasn't sure you would cover it. Layers are great.

BrandonNyman
Автор

Your videos are addictive ! Can't believe it's already ep.5

skudgee
Автор

Code for teleportation

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using
using UnityEngine.InputSystem;

public class ActivateTeleportationRay : MonoBehaviour
{
public GameObject leftTeleportation;
public GameObject rightTeleportation;

public InputActionProperty leftActivate;
public InputActionProperty rightActivate;

public InputActionProperty leftCancel;
public InputActionProperty rightCancel;


// Update is called once per frame
void Update()
{
== 0 && > 0.1f);
== 0 && > 0.1f);
}
}

Be sure to have the same names as in the video.

Yolakx
Автор

I did the script myself, Its so fun, I start to understand how things work

IronBee_official
Автор

Excellent video for studying VR development! Everything was done. Thank you!

ievgengolovin
Автор

Very informative thanks for this amazing video brother.

vasurabadiya
Автор

something i learned is that the ground should have a box collider, since sometimes the cubes can phase through the ground if it goes straight down

boogiehasfun
Автор

13:34 you should not check equality on float. And you are checking an analog input (trigger) which may never be 0 (zero). You better check it with a threshold something like x < 0.1f . Great tutorial by the way, saved tons of time. Thank you.

Автор

Thanks Valem! These have been great tutorials.

SwordOfShaolin
Автор

i love this im actually making a vr game thanks for the help man

NoahVR
Автор

For those who have motion of character, throwing character away while picking box, make sure you reduce your capsule collider radius

Sushanth-mo
Автор

Hello Valem. I am a huge fan of yours and very thankful for you. Would It be possible to make a tutorial on inventory? This would be much appreciated. Thanks, Henry

dreamrender
Автор

@ValemTutorials, I have noticed that right hand/left hand requires different attach points. Is there a built in way to select which attach point is used (I created two per item) based on what hand is grabbing the item?

OramiIT
Автор

I assume the issue evident at the very end of the video where the attach transform only works with one hand (the right in your case) will be solved in the next video? My attach transform for the pistol looks fine for the right hand, but is too far right when holding in the left hand, so the hand is not centered on the grip of the pistol.

Arashi