Forum Discussion
craigsanto
9 years agoHonored Guest
Porting a VR Asset
Hello everyone,
I'm new to VR Development, so I've been looking at the Unity and Oculus tutorials.
In the Unity VR Samples package, they have an item called a Selection Slider that I wanted to play with in my project. I just want the bar to fill up as the player hovers over it, without the need for any controller input. But there's a slight compatibility issue: using OVR's OVRPlayerController instead of UnityVR's Main Camera. I've been trying to solve this issue.
I know that there's some basic UI work in the Oculus Sample Framework, but copying all of the code over gets really ugly really quickly, and I don't feel like it's necessary.
Here's what I've done:
In UnityVR's SelectionSlider.cs:
In UnityVR's VREyeRaycaster.cs:
I'm new to VR Development, so I've been looking at the Unity and Oculus tutorials.
In the Unity VR Samples package, they have an item called a Selection Slider that I wanted to play with in my project. I just want the bar to fill up as the player hovers over it, without the need for any controller input. But there's a slight compatibility issue: using OVR's OVRPlayerController instead of UnityVR's Main Camera. I've been trying to solve this issue.
I know that there's some basic UI work in the Oculus Sample Framework, but copying all of the code over gets really ugly really quickly, and I don't feel like it's necessary.
Here's what I've done:
In UnityVR's SelectionSlider.cs:
- Commented out all references to m_VRInput, as I don't want the player to have to press a button upon hovering over the slider
- Added a call to HandleDown() at the end of HandleOver() - I could've just copied the two lines of code contained within, but I don't think this is a problem. I just want the bar to start filling up without the need for a button press.
In UnityVR's VREyeRaycaster.cs:
- Changed the line "[SerializeField] private Transform m_Camera;" to "[SerializeField] private Transform m_Camera = GameObject.Find("OVRPlayerController").transform.FindChild("CenterEyeAnchor");"
- In other words, I've tried instantly shifting the Camera Transform to OVR's CenterEyeAnchor. But maybe that's being undone? Maybe I'm not doing that properly?
- Does it have to do with how I set up my objects? The Sliders are currently the children of the objects they've been placed on.
- Do I need to add colliders to the sliders manually? I wouldn't think so, but it's a possibility.
- I wanted to add a crosshair/reticle to the game to make it easier to identify what exactly the player is looking at. UnityVR has a nice Reticle, but I'm sure I'd run into even more issues trying to port that over as well. OVR claims to have a crosshair in the documentation, but I can't access it in the code - it doesn't even seem to exist in the sample framework. What's going on, and what's my best option?
Replies have been turned off for this discussion
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 11 months ago
- 1 year ago
- 10 months ago
- 1 year ago
- 11 months ago