There is no 'Animator' attached to the "One Hand First Person Nolan" game object

TheLogan

New member
I just bought this add-on and I'm having some trouble getting it to work, the demo scene, it seems that there's supposed to be an animator attached to the One Hand First Person Nolan object, but it's not actually there.
Can anyone help me with this?
Also my controllers aren't being registered (but I guess that's because of the issue above).
My system btw is Valve Index so I've set it up as an HTC Vive
 

Justin

Administrator
Staff member
This was a bug caused by version 2.2.6 of the character controller. It has been fixed in the recently released version 2.2.7. If you add the following to line 183 of AnimatorMonitor it will fix it:

Code:
if (m_Animator == null) {
   return;
}
 

TheLogan

New member
That solved the first issue, now I have this

IndexOutOfRangeException: Index was outside the bounds of the array.
Opsive.UltimateCharacterController.AddOns.VR.Character.Abilities.Items.SlotEquip.Awake () (at Assets/Opsive/UltimateCharacterController/Add-Ons/VR/Scripts/Character/Abilities/Items/SlotEquip.cs:80)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.Awake () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:323)


And also a few of these
Error: The First/Third Person Shootable Weapon Properties component cannot be found for the Item Left Assault Rifle.Ensure the component exists and the component's Action ID matches the Action ID of the Item (0).
UnityEngine.Debug:LogError(Object)
Opsive.UltimateCharacterController.Items.Actions.ShootableWeapon:Start() (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/ShootableWeapon.cs:418)

for left and right assault rifle, shotgun and pistol.


And then this one
NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Items.Actions.Flashlight.OnChangePerspectives (System.Boolean firstPersonPerspective) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/Flashlight.cs:158)
Opsive.Shared.Events.InvokableAction`1[T1].Invoke (T1 arg1) (at <fa7bae0bde914e57874fdb6999909243>:0)
Opsive.Shared.Events.EventHandler.ExecuteEvent[T1] (System.Object obj, System.String eventName, T1 arg1) (at <fa7bae0bde914e57874fdb6999909243>:0)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.OnAttachLookSource (Opsive.UltimateCharacterController.Character.ILookSource lookSource) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:623)
Opsive.Shared.Events.InvokableAction`1[T1].Invoke (T1 arg1) (at <fa7bae0bde914e57874fdb6999909243>:0)
Opsive.Shared.Events.EventHandler.ExecuteEvent[T1] (System.Object obj, System.String eventName, T1 arg1) (at <fa7bae0bde914e57874fdb6999909243>:0)
Opsive.UltimateCharacterController.Camera.CameraController.InitializeCharacter (UnityEngine.GameObject character) (at Assets/Opsive/UltimateCharacterController/Scripts/Camera/CameraController.cs:486)
Opsive.UltimateCharacterController.Camera.CameraController.set_Character (UnityEngine.GameObject value) (at Assets/Opsive/UltimateCharacterController/Scripts/Camera/CameraController.cs:66)
Opsive.UltimateCharacterController.Demo.DemoManager.SelectStartingPerspective (System.Boolean firstPersonPerspective, System.Boolean teleport) (at Assets/Opsive/UltimateCharacterController/Demo/Scripts/DemoManager.cs:426)
Opsive.UltimateCharacterController.AddOns.VR.Demo.VRDemoManager.Start () (at Assets/Opsive/UltimateCharacterController/Add-Ons/VR/Demo/Scripts/VRDemoManager.cs:109)

And finally this one
IndexOutOfRangeException: Index was outside the bounds of the array.
Opsive.UltimateCharacterController.Game.KinematicObjectManager.SetCharacterMovementInputInternal (System.Int32 characterIndex, System.Single horizontalMovement, System.Single forwardMovement) (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:630)
Opsive.UltimateCharacterController.Game.KinematicObjectManager.SetCharacterMovementInput (System.Int32 characterIndex, System.Single horizontalMovement, System.Single forwardMovement) (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:619)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:71)

I don't know how many are caused by issues before them though, but they seem to be stopping me from being able to play the demo.

Also I checked for 2.2.7 and it doesn't seem to be on the package manager yet.
 

Justin

Administrator
Staff member
What controller variant are you using? Based off of those errors it doesn't look like the object references were removed for the controller variant that you are using. For example:

Code:
Opsive.UltimateCharacterController.AddOns.VR.Character.Abilities.Items.SlotEquip.Awake () (at Assets/Opsive/UltimateCharacterController/Add-Ons/VR/Scripts/Character/Abilities/Items/SlotEquip.cs:80)

Will only generate an error if you have a null Item Definition in the Default Item Definitions. I would reimport everything in a fresh project, make the AnimatorMonitor change above, and then open the demo scene and resave it. This will then allow the Object Remover to remove the references that the controller variant you are using does not contain.
 

TheLogan

New member
I suspect the answer would be SteamVR, as I've got a valve Index, and it's the SteamVR project I've loaded into my project.
Their demo scenes both work for me without issues.
I tried it in a clean project with only SteamVR, UFPS and the UFPS VR addon in the project, the same exact result as in my original project. (this time with version 2.2.7, so didn't need to make the edit).

Well, there is one weird difference, the hand material is missing (they are magenta), but everything else has materials.
 

Justin

Administrator
Staff member
I imported the VR add-on into just a UFPS project and I am getting the same errors. Taking a closer look it does look like the reason is because of the melee item definition. Within SlotEquip.Awake if you change this block:

Code:
            // Only certain items can be equipped when the character spawns.
            var inventory = m_Inventory.GetComponent<Inventory.Inventory>();
            if (inventory != null && inventory.DefaultLoadout != null && inventory.DefaultLoadout.Length > 0) {
... existing code ...
            }

to:
Code:
            // Only certain items can be equipped when the character spawns.
            var inventory = m_Inventory.GetComponent<Inventory.Inventory>();
            if (inventory != null && inventory.DefaultLoadout != null && inventory.DefaultLoadout.Length > 0) {
                if (m_DefaultItemDefinitions != null) {
                    m_DefaultItemIdentifiers = new IItemIdentifier[m_DefaultItemDefinitions.Length];

                    var defaultLoadout = new List<ItemDefinitionAmount>();
                    for (int i = 0; i < m_DefaultItemDefinitions.Length; ++i) {
                        m_DefaultItemIdentifiers[i] = m_DefaultItemDefinitions[i].CreateItemIdentifier();

                        for (int j = 0; j < inventory.DefaultLoadout.Length; ++j) {
                            if (m_DefaultItemDefinitions[i] == inventory.DefaultLoadout[j].ItemDefinition) {
                                defaultLoadout.Add(inventory.DefaultLoadout[i]);
                                break;
                            }
                        }
                    }
                    if (inventory.DefaultLoadout.Length != defaultLoadout.Count) {
                        Debug.LogWarning("Warning: The SlotEquip ability removed items from the default loadout.");
                    }
                    inventory.DefaultLoadout = defaultLoadout.ToArray();
                }
            }

It should fix the errors. Let me know if that works and I'll submit this as an update.
 

TheLogan

New member
That did indeed fix the issue, now a new issue has cropped up.

1606727274194.png

I've gone to the installed add-ons tab, set the headset to Htc Vive (as I'm assuming it's sort of the same as Valve Index) clicked the Update Buttons button (update inputs would probably be a more descriptive name btw). The missing inputs, however, are still missing. From looking it over I'm guessing it's because the Index controllers have finger tracking and stuff that the Vive doesn't.
 

Justin

Administrator
Staff member
Those look like more of the errors I'd expect to see :)

From looking it over I'm guessing it's because the Index controllers have finger tracking and stuff that the Vive doesn't.
Yes, that's correct. I'm not sure of the button mappings for the Index controls but they'll need to be updated to match.
 

TheLogan

New member
I got the last of the inputs set up but the hands are still not tracking.
I'm not getting any errors, and just a single warning

Warning: The SlotEquip ability removed items from the default loadout.
UnityEngine.Debug:LogWarning(Object)
Opsive.UltimateCharacterController.AddOns.VR.Character.Abilities.Items.SlotEquip:Awake() (at Assets/Opsive/UltimateCharacterController/Add-Ons/VR/Scripts/Character/Abilities/Items/SlotEquip.cs:90)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion:Awake() (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:323)
 

Justin

Administrator
Staff member
That is the warning that I was expecting you to get. You can fix it by removing the Body ItemType from the SlotEquip Default Item Definitions.

For the hands not tracking, does t he HandTracker component exist on the hands? The HandTracker uses the NodeStates API so as long as the hand is registered with Unity's VR system then it should work. I really wish I had an Index to test on.
 

TheLogan

New member
There is not a HandTracker on either of the hands.
If I add one I can see the hands jerkily rotate (though they don't move position and they don't seem to discern between the different hands (both controllers rotate both hands at the same time), I can't see a way to set what controller should move what hand
 

Justin

Administrator
Staff member
Sorry, on the main character the HandHandler component should be added. The HandTracker is for one handed setups.

Is the HandHandler component added? The HandHandler still uses the NodeStates API to set the location of the hand GameObjects within UpdateLocation. If you log this method is the location being retrieved?
 

TheLogan

New member
Oh, ok.
I was actually heading off to bed but just took the time to test it.
The hand handler is added yeah, but after running a few debug functions and nothing being printed I discovered that it's actually being disabled. I need to get to bed so I don't have time to dig into why it's being disabled tonight, but if you have any ideas I'll check it out tomorrow! :)
 

TheLogan

New member
I just started up the project again ran it, the HandHandler got disabled (I still haven't figured out why), I re-enabled it and the hands are now tracking to the controllers exactly as they are supposed to

EDIT
I wrote that too quickly xD
The first time I ran the game the headset was way too high up (like I was 3-4 meters above the floor), the hands tracked correctly there.
The second time, I was at floor level, but once I enabled the HandHandler the hands still tracked "correctly" but 3-4 meters above the floor, while the camera was at the correct height. Also, the buttons, gripping etc don't seem to actually do anything.
 
Last edited:

Justin

Administrator
Staff member
The Hand Handler should not be disabled which makes me think something got changed. As a test if you reimport the VR demo scene does it start enabled? And does it position correctly? If not, what happens when you recenter the camera through the UI option?

Also, the buttons, gripping etc don't seem to actually do anything.
That likely relates to needing to update the input manager to map to the Index buttons.
 

TheLogan

New member
I'll try to reimport everything tomorrow, but I just discovered that the steamVR system uses its own input system and entirely ignores the Input Manager (in a bid to be input agnostic)
 
Top