I know 2.2.1 is deprecated but I'm still someone in the wild using it for now.
I just noticed that when using externalcamera.cfg for mixed reality it breaks all things related to the bow example. The bow, arrows and the arrow spawner.
This is the only information I was able to get.
NullReferenceException: Object reference not set to an instance of an object
at VRTK.Examples.Archery.BowAim.DoObjectGrab (System.Object sender, InteractableObjectEventArgs e) [0x00000] in <filename unknown>:0
at VRTK.VRTK_InteractableObject.OnInteractableObjectGrabbed (InteractableObjectEventArgs e) [0x00000] in <filename unknown>:0
at VRTK.VRTK_InteractableObject.Grabbed (UnityEngine.GameObject currentGrabbingObject) [0x00000] in <filename unknown>:0
at VRTK.VRTK_InteractGrab.InitGrabbedObject () [0x00000] in <filename unknown>:0
at VRTK.VRTK_InteractGrab.GrabInteractedObject () [0x00000] in <filename unknown>:0
at VRTK.VRTK_InteractGrab.AttemptGrabObject () [0x00000] in <filename unknown>:0
at VRTK.VRTK_InteractGrab.DoGrabObject (System.Object sender, ControllerInteractionEventArgs e) [0x00000] in <filename unknown>:0
at (wrapper delegate-invoke) VRTK.ControllerInteractionEventHandler:invoke_void__this___object_ControllerInteractionEventArgs (object,VRTK.ControllerInteractionEventArgs)
at VRTK.VRTK_ControllerEvents.OnAliasGrabOn (ControllerInteractionEventArgs e) [0x00000] in <filename unknown>:0
at VRTK.VRTK_ControllerEvents.EmitAlias (ButtonAlias type, Boolean touchDown, Single buttonPressure, System.Boolean& buttonBool) [0x00000] in <filename unknown>:0
at VRTK.VRTK_ControllerEvents.Update () [0x00000] in <filename unknown>:0
(Filename: Line: -1)
I would like to know how to modify the affected script to protect itself from this issue. I'm assuming it's because externalcamera.cfg and mixed reality uses a 3rd controller for camera tracking and some how this is breaking something in the vrtk script.
It's a lot of work for me to migrate to 3.1 so I cannot budget the time yet. I made poor coding decisions and I'm too tightly coupled to 2.2.1.
I would appreciate if you could post a patch that I could then manually drag and drop into my project.
It looks like that script calls into the VRTK_DeviceFinder to get the left and right controller objects. The Device Finder in turn calls into the VRTK_SDK_Bridge which returns the left or right fields of the SteamVR_ControllerManager in the scene.
I guess you should check and make sure that the left and right objects on that script are set correctly when used with a third controller. Alternatively let me know your SteamVR plugin version so I can have a look at what the error may be.
I'm using 1.1 for now. And in this case there isn't a third controller connected. It's just the presence of the externalcamera file that causes this. Maybe it's due to the absence of the third controller?
It looks like the SteamVR_ControllerManager isn't doing anything special just because that file exists and nothing else looks to be changing the left or right fields on the manager as far as I can see.
So sorry: No idea why that's happening 馃槱
@thestonefox considering this is an issue for me and my customers can I ask why this is being closed without comment?
Could I please get a fix to this script? If you load up your own vanilla version of the bow, with the externalcamera.cfg do you not experience it?
Because we have no known solution and you're on an extremely old version of vrtk. It's not possible to support every historic version.
I feel like this is an exaggeration, not supporting every historic version. I'm asking for support with the latest release of v2.
It's maybe extremely old by VR timelines, but you replaced 2.2.1 only 4 months ago. It's not realistic to drop everything to migrate to a breaking version of your API when the game itself has its own development schedule which will now be off track to address this.
I suppose if I identified this bug prior to v3 this would have received priority. So I should have attempted mixed reality sooner.
This leaves me with concerns about using VRTK going forward. I'm using the tip of version 2, usually with 3rd party libraries there's some expectation of maintenance with past software versions, security and bug fixes, but no new features. At least support for the previous major version, which this is.
This just worries me that when you release V4 I'll have the same lack of support with 3.1. This really isn't uncommon. To hold back on a migration for a while to favour stability over new features, knowing that migration requires full regression testing and has a real cost associated to it.
Anyway your position is what is it, just figure this is a point of view you could consider.
Considering this project is done in whatever spare time I have (and whatever the community can give) I think it's fair to only support the most recent version.
If you had paid for the product then I would understand your position more, however this is a community driven project. Feel free to find the solution and contribute it back accordingly.
Oh and btw: 2.2.1 was released 7.75 months ago 馃槃
It's just way too hard to figure this problem out for you and I already did my best above. I don't have your setup so I can't attach the debugger. The code itself points to SteamVR being weird which is, btw, also very old and Valve isn't giving any previous version support (or any, really) at all basically.
2.2.1 might have been released 7.75 months ago, but I was pretty sure it was only replaced by v3 in January. I started this game around 7 months ago so that would be why I'm on 2.2.1. When v2 was released doesn't really have any bearing on my point, only when it was replaced. Which by my math means this library has a very short life cycle and I think that's important to consider as a customer.
As far as reproduction goes I'd assume a vanilla deploy of 2.2.1 with the externalcamera.cfg would have exposed this, not requiring my code specifically. It wasn't clear to me that you think the issue is with steamvr and not VRTK. I can take it upon my self to test with steamvr 1.2 or whatever is recent as of today.
Maybe I'm simply spoiled from the web ecosystem where most 3rd party libraries are not paid for and are community driven but receive support. Those however are used by a much larger audience, and some have financial backing by large companies that depend on these projects. To be fair you do make money off of this but I get that this isn't enough income to become a full time occupation.
Anyway I'm sorry I'm really not trying to be a jerk here. I guess I assumed this would be an easy fix for you and a hard fix for me. Like the presence of the third controller is throwing some expected index off or something like that.
If I can address the issue I will contribute back. If the attempt takes too much effort it will be cheaper to migrate to 3.1 and I'll do that instead.
Thanks for the investigation that you did.
VRTK piggy backs on the vendor SDKs. In this case we just ask SteamVR for the left and right controllers, one of them returning null in your case. Sometimes SteamVR decides the indexes change for left+right but we've never seen any of them just becoming null. Even then this would be a problem on SteamVR's end (the SteamVR_ControllerManager).
VRTK is sadly not receiving any big company support, @thestonefox tried, believe me. 馃槱
Notes:
As your stack trace has no line numbers, here's the method in question
https://github.com/thestonefox/VRTK/blob/8f529d0cec72fa91a7b60b6d17508606baa15b41/Assets/VRTK/Examples/Resources/Scripts/Archery/BowAim.cs#L62-L81
Therefore I think the null ref is on either VRTK_DeviceFinder.GetControllerLeftHand or VRTK_DeviceFinder.GetControllerRightHand. These just call into the respective method on VRTK_SDK_Bridge:
https://github.com/thestonefox/VRTK/blob/8f529d0cec72fa91a7b60b6d17508606baa15b41/Assets/VRTK/Scripts/VRTK_DeviceFinder.cs#L146-L162
Those then just return the left or right fields on the controller manager:
https://github.com/thestonefox/VRTK/blob/8f529d0cec72fa91a7b60b6d17508606baa15b41/Assets/VRTK/SDK/SteamVR/VRTK_SDK_Bridge.cs#L81-L99
The controller manager is of type SteamVR_ControllerManager:
https://github.com/thestonefox/VRTK/blob/8f529d0cec72fa91a7b60b6d17508606baa15b41/Assets/VRTK/SDK/SteamVR/VRTK_SDK_Bridge.cs#L440-L447
So if we have a look at the SteamVR plugin, v1.1.1:
https://github.com/ValveSoftware/openvr/blob/70acfe9262290ddb789588a7390e5fc60bb20080/unity_package/Assets/SteamVR/Scripts/SteamVR_ControllerManager.cs
This looks pretty much the same as the current plugin does I think. I would suggest attaching the debugger here and figuring out what's happening. 馃
P.S.: You're right about the date of release vs. date of v3 of course. I understand your arguing there.
To be clear I do NOT make money off this project.
For anyone reading this in the future (don't worry @ssshake, just making sure everyone understands this, as you'll see in the links VRTK has got some trolls spreading false info 馃槱):
To be clear I do NOT make money off this project.
References:
https://www.reddit.com/r/Vive/comments/654b1q/vrtk_amazing_toolkit_and_its_free_why_not_pledge/dg7o21l/
https://www.reddit.com/r/Vive/comments/654b1q/vrtk_amazing_toolkit_and_its_free_why_not_pledge/dg879tb/
Sorry dude, I was just referring to the gross income on patron. But I now understand you are allocating this for resources after reading the reddit. This is the same in how my video game earns a few thousand dollars in early access sales but I'm not personally pocketing any of the money, it sits in a bank account and is used for the purchasing of assets and resources for the game.
Thanks for the additional info and links in the reply today that actually helps me understand the issue better.
We are way off topic now so I'm sorry for this going off the rails. I am surprised that no company is interested in funding an abstraction layer like this especially since many games are steamvr, oculus and psvr capable.