Model switch first person arms issue

matmalm

Member
Hi, I'm using the Model Manager to switch models in my character prefab.
When I start with a model, pick up an item, drop the item, and then switch to the other model and I pick up the same item, both first person arms appears in the same parent.
Looking something like this:
opsivefirstperson.png
In the image the FPSMesh - Player_1_arms appear under the pivot of the other model instead of its own pivot.
 
To get started does the demo scene work correctly? Are you using FPS Mesh Tool?
In the demo scene I have the same problem.

Go to the switch character scene inside the Demo, select the pistol and drop it in the Rhea area (where it switches to her model, so she can grab it), go to her area to switch to her model and pick up the pistol:
demoscene.png

There are also some mismatching animator parameters, like the crouching state works good with Atlas but not with Rhea (the camera doesn't go down), or when selecting the pistol and switching, the first time will throw a IndexOutOfRangeException.

I'm using FPSMeshTool in my project. Unity 6.0.24 URP. UFPS package.
 
The pivot GameObjects do not get disabled. These are always enabled and it's the child GameObjects that get disabled. I didn't set Rhea up for crouching with the camera but can do so.

This may be something related to FPSMeshTool. I didn't create the integration and am not sure if the integration supports model switching.
 
The pivot GameObjects do not get disabled. These are always enabled and it's the child GameObjects that get disabled. I didn't set Rhea up for crouching with the camera but can do so.

This may be something related to FPSMeshTool. I didn't create the integration and am not sure if the integration supports model switching.
Confused on what actually controls the pivot first person arms to get off, as in the demo scene it also happens.

I'm not using the FPSMeshTool integration for the material state, I use different layers for the arms and the rest of the body, culling them with the camera. But I don't see how that affects the object being enable/disable.
 
Last edited:
The pivot position stays enabled in the demo scene - this is expected. The child GameObject gets disabled.
 
The pivot position stays enabled in the demo scene - this is expected. The child GameObject gets disabled.
I created a new Unity 6 URP project, just imported UFPS 3.1.3 with the URP integration, run the Demo scene, go to the switch character scene, and the pivot object get disabled. It doesn't happen what should be expected.

opsiveufpsdemo.png
 
Those disabled objects are for the other character, Rhea. The pivot object stays active as long as that character is active. The child GameObject gets disabled if the weapon is not equipped.

In your original screenshot you have both FPSMesh_Player1 and FPSMesh_Player2 objects under the same FirstPersonObjects GameObject. This is why yours is staying enabled, it's similar to the pivot GameObject staying enabled. This is likely how FPSMeshTool sets up the integration so I would talk to the developer to see if they support character switching. If they don't they can subscribe to the OnCharacterSwitchModels to be notified when there is a change.
 
Those disabled objects are for the other character, Rhea. The pivot object stays active as long as that character is active. The child GameObject gets disabled if the weapon is not equipped.

In your original screenshot you have both FPSMesh_Player1 and FPSMesh_Player2 objects under the same FirstPersonObjects GameObject. This is why yours is staying enabled, it's similar to the pivot GameObject staying enabled. This is likely how FPSMeshTool sets up the integration so I would talk to the developer to see if they support character switching. If they don't they can subscribe to the OnCharacterSwitchModels to be notified when there is a change.
In my screenshot I'm showing what happens after I pick up the item with one character after I dropped it with the other character.
Originally, when switching characters, the first person arms stay in the right child, but my whole point of the topic is an issue in which:
If Player1 picks up an item, and then drop that same item, then I switch to Player2, the arms get in the incorrect game object.

It's not a matter of staying enabled/disabled those root objects. It's that if I pick up the same item, after switching, the FirstPersonArms goes to the wrong root object.


Please do the test in the Demo scene and it happens the same behavior as in my scene:
Do the following:
Go to the switch character scene inside the Demo, select the pistol and drop it in the Rhea area (where it switches to her model, so she can grab it), go to her area to switch to her model and pick up the pistol:

This happens after I pick up the pistol with Rhea:

index.php

The AtlasFirstPersonRightArm goes automatically to the Root FirstPersonObjects of Rhea.

As I said, I just imported UFPS 3.1.3 in an empty Unity 6 URP project with the URP integration.
That's what happens.

Same behavior than with my project.
 
I am looking at this now. How are you switching to Rhea? In the split screen section you can't switch characters so I am wondering what method you are using to switch characters. This will directly affect how the FirstPersonObjects are added.

Better yet if you can send a repro scene to support@opsive.com that'll allow me to instantly reproduce it.
 
I am looking at this now. How are you switching to Rhea? In the split screen section you can't switch characters so I am wondering what method you are using to switch characters. This will directly affect how the FirstPersonObjects are added.

Better yet if you can send a repro scene to support@opsive.com that'll allow me to instantly reproduce it.
It's not in the Mirror scene, but in the Character Switch scene (inside the demo scene).
 
Thank you - I forgot about that zone :D

I have this fixed. It took a lot of changes related to the reinitialization when the item is added back to the item. There was a lot of caching being done. It will be in the next update.
 
Thank you - I forgot about that zone :D

I have this fixed. It took a lot of changes related to the reinitialization when the item is added back to the item. There was a lot of caching being done. It will be in the next update.
Great, thanks. Looking forward :)
 
Thank you - I forgot about that zone :D

I have this fixed. It took a lot of changes related to the reinitialization when the item is added back to the item. There was a lot of caching being done. It will be in the next update.
Hey, so after some testing, now it works good to drop/pick up items with the character being switched. But there is still another bug in which the animations get disabled (or the abilities).

For testing: You can go to the demo scene, go to the character switch zone, don't press anything and go directly to the Rhea area, then go back to Atlas area and switch to the pistol, then go to the Rhea area. Every animation will be disabled and it will stop the switch to Atlas again (might not be the animations but the abilities).

That's for the demo scene, which I think is related to an issue happening in my project in which when I switch to a specific character the crouch ability doesn't work correctly.
 
Last edited:
Can you record a video of that? I'm not seeing the same thing. Here's what I tried:

1. Switched into the character switch zone.
2. Walked over and switched to Rhea.
3. Walked back and switched to Atlas.
4. Pressed Q to equip the pistol.
5. Walked back and switched to Rhea.

After this I was able to fire with Rhea, and also switch back to Atlas.
 
Can you record a video of that? I'm not seeing the same thing. Here's what I tried:

1. Switched into the character switch zone.
2. Walked over and switched to Rhea.
3. Walked back and switched to Atlas.
4. Pressed Q to equip the pistol.
5. Walked back and switched to Rhea.

After this I was able to fire with Rhea, and also switch back to Atlas.

It gives me this error:
errordemo.png

Well, in my personal project it doesn't give me that error, so maybe it's not related.
In my project I have 2 different character models, with the same set up as in the demo scene, but only with 1 character model the crouching ability doesn't work well. It happens when with that character model I'm moving or pressing the toggle key too fast that the crouching ability gets stuck in the active state. With the first character model it works well.
No idea how to debug it as both character models have the same setup.
 
By any chance did you modify the first person arms or pistol animator controller at all? What index is trying to be retrieved within GetParameter? You can add a Debug.Log just before the error line. I am not getting the same results as you.

Code:
                        Debug.Log(j);
                        if (m_Animator.GetParameter(j).nameHash == slotIDHash) {
 
By any chance did you modify the first person arms or pistol animator controller at all? What index is trying to be retrieved within GetParameter? You can add a Debug.Log just before the error line. I am not getting the same results as you.

Code:
                        Debug.Log(j);
                        if (m_Animator.GetParameter(j).nameHash == slotIDHash) {
I didn't. I even removed the Opsive folders before updating as it was necessary. I usually import the demo scene in a separate project than my own.

It's trying to retrieve index parameter 0 then it throws me the error. It only happens with the order of actions I do with the character models in the video. If I don't go to the Rhea area before and just press Q to pull the pistol, then it works good, otherwise it gives me that error.

As for my personal project however, I don't know if it's related, as it doesn't throw me any error so it's more difficult to debug. I have an issue in which with 1 of the character models if I press too fast the crouch toggle, or if I move and press the crouch toggle, the character crouches but then the ability stays active, not allowing the character to stand up again.

I tried to isolate the problem, and it appears to be only an issue with the index 1 (second character model) in the Model Manager script. I tested switching the order of the character models in the script, and it was always the second character model which was not working properly. So even if I just start with the index 1 character model, the ability will not work correctly.


Found a kind of similar issue in the demo scene, in which if the character:
- Go to Rhea zone and crouch, stay crouched
- Go to Atlas zone
- Stand up and crouch again
- Go to Rhea zone crouched
The crouch ability stays active

 
Last edited:
Thanks, I was able to reproduce that so will focus on it. I'll post the solution if it's a small fix otherwise it'll be in the next update (which will be soon because of the upcoming BDPro release)
 
Back
Top