Daggerfall Unity VR with the Vive Pro

Discuss coding questions, pull requests, and implementation details.
Post Reply
User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

Sounds like you're still plugging along, awesome!

I'll add a helper to inject actions into the list rather than make it public. I had this in mind anyway when talking about injecting actions. I'm glad you have a workaround for now though.

You might not need to make MainCamera public - should be able to grab a reference from GameManager.Instance.MainCamera.

I can see how decoupling the PlayerActivate ray casting would add more flexibility. Please hack away to fit your needs now, and this will help inform me how we can do this upstream in a way that helps you. :)

User avatar
InconsolableCellist
Posts: 100
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

Awesome! How's this look for the action feature? Just a simple change, and it works for my code: https://github.com/Interkarma/daggerfall-unity/pull/811

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

Yep, that's perfect. Exactly how I would have done it. :)

User avatar
InconsolableCellist
Posts: 100
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

I'm seeing this intermittent behavior that I don't understand, I'm wondering if you ever ran into it in Unity. When I shoot a ray from my controller towards an object, like a door, after activating it once it'll say that it's hitting the CombinedModels GameObject rather than the door itself. PlayerActivate also reports this, and it ends up just doing a Debug.Log in PlayerActivate.cs:486, "// Debug for identifying later furniture model ids."

It's like it stops reporting the correct object as being hit.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

I'm not really familiar with any problems here. Can you activate doors to open/close normally with your ray casts?

When door is in a closed state, the collider is a physical object (to prevent player from passing). But when in an open state the collider is changed to a trigger only, so player can physically walk through door object but still activate it to close again (like classic). During the opening and closing tween states, the trigger is not selectable with rays.

All I can suggest as a debug step is to visualise the ray from your controller and maybe output the target in realtime to some debug text, perhaps above the controller itself. That way you can confirm ray is actually striking the door object properly.

User avatar
InconsolableCellist
Posts: 100
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

Hah yeah, I've been going down that path too. I've added a translucent green cube that I position over any object that the Ray hits, and that helps me at least see that it knows an object is there. It's something strange about the hit in the PlayerActivate not interacting right. Maybe having two hits in the same frame? Or maybe the rayEmitter instance (I renamed MainCamera to this in there) getting reset? I'll check that.

I'm unfortunately using the wrong version of Unity, 2018.1.1f1, so this could possibly be a regression. I don't think I can downgrade the scene files at this point though.

Thanks

User avatar
InconsolableCellist
Posts: 100
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

Hmm, can you take a look at PlayerActivate.cs:124?

Code: Select all

                
playerLayerMask = LayerMask.NameToLayer("Player");
...
// Fire ray into scene for hit tests (excluding player so their ray does not intersect self)
...
bool hitSomething = Physics.Raycast(ray, out hit, RayDistance, playerLayerMask);
That should mean that it includes the "Player" layer, and only that layer, unless I'm very mistaken:

https://answers.unity.com/questions/416 ... ayers.html

Code: Select all

layerMask = 1 << LayerMask.NameToLayer ("layerX"); // only check for collisions with layerX
     
layerMask = ~(1 << LayerMask.NameToLayer ("layerX")); // ignore collisions with layerX
I may still have a bug but I'm getting better behavior with this:

Code: Select all

int mask = ~(1<<LayerMask.NameToLayer("Player"));
bool hitSomething = Physics.Raycast(ray, out hit, RayDistance, mask);

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

Based on docs that should be the case, but it didn't actually function that way in 5.5 (it worked opposite to docs).

If this now behaves correctly in newer versions of Unity I will review. But at this time in 2018.1.2f1 this is continuing to work as per 5.5.

What version of Unity are you on again?

User avatar
InconsolableCellist
Posts: 100
Joined: Mon Mar 23, 2015 6:00 am

Re: Daggerfall Unity VR with the Vive Pro

Post by InconsolableCellist »

Weird. I'm on 2018.1.1f1, and I used the mask feature elsewhere in my code, and thought it worked the way that it's supposed to in the docs. You mean they inverted the logic in a bug? What's a reliable method for testing?

I would expect having the wrong layer mask to always make the ray fail, but weirdly I don't see that with either way of doing it. It's almost like it's partially or intermittently ignoring that setting.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Daggerfall Unity VR with the Vive Pro

Post by Interkarma »

The inversion only seems to happen for that raycast. I use this elsewhere for other collision checks and it works as per docs. Possibly some other latent issue I'll need to look at.

I'm certainly not experiencing any issues with the default game that I'm aware of. At work right now, so cannot check function or reply in detail now.

Post Reply