Multiplayer and Second Player Arrow Shooting doesnt work

Saddam Khan

New member
Hi There,

There are a few issues that i am facing. I have been trying to make a game like PUBG but with bows and arrows my main weapons. The problem that i am facing is that When the second player connects, transform and animation are not synched. It spawns at (0,0,0)

Also the with the second player Shooting arrow doesn't work just like it was before before i upgraded opsive ultimate controller to 2.2

And as the first player disconnects, second player started shooting arrows.

Can you please help me figure out whats happening? We are already late on this project.
 

Justin

Administrator
Staff member
To get started does the demo scene arrows work correctly in a fresh project? I just tried it and on both the client and the server the arrow spawned in the correct position.
 

Saddam Khan

New member
Yes it worked correctly. But still there was some glitch when the second player shoots an arrow. Its start from some other point.

Also can i send you the build that i am working on? Because the arrow wouldn't even spawn on the second character? If you can kindly have a look at it?
 

Saddam Khan

New member
Also what is happening with me is that the second player when spawns, it spawns at some random place some where at X=1000 Z=1000

Also when the second player shoot an arrow it is instantiated at the clients body automatically and not where it was shot.
 

Justin

Administrator
Staff member
Due to my support load I'm not able to take a look at custom code. Since the demo scene works correctly it sounds like there is something specific to your project.

The arrow is spawned within ShootableWeapon.ProjectileFire, under the NetworkSpawn call. You can start by ensuring the arrow is spawned within the correct position from this RPC call.
 

Saddam Khan

New member
Hi Again, i some how managed to synched animation and position

Now the arrow problem is still there. Over the network Arrow shooting is managed by the network and have checked RPC too. I am not getting this error after shooting some arrows


Unable to pool Arrow1ShootablePUN(Clone) (instance -5402680): the GameObject was not instantiated with ObjectPool.Instantiate.
UnityEngine.Debug:LogError(Object)
Opsive.Shared.Game.ObjectPoolBase:DestroyInternal(GameObject)
Opsive.Shared.Game.ObjectPoolBase:Destroy(GameObject)
Opsive.UltimateCharacterController.Items.Actions.ShootableWeapon:projectileFire(Single) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/ShootableWeapon.cs:759)
Opsive.UltimateCharacterController.Items.Actions.ShootableWeapon:Fire(Single) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/ShootableWeapon.cs:739)
Opsive.UltimateCharacterController.Items.Actions.ShootableWeapon:TryStopItemUse() (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/ShootableWeapon.cs:1153)
Opsive.UltimateCharacterController.Character.Abilities.Items.Use:CanStopAbility() (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/Use.cs:816)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion:TryStopAbility(Ability, Boolean) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1413)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion:TryStopAbility(Ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1395)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler:TryStopAbility(Ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:241)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler:UpdateAbilityInput(Ability[]) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:119)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler:UpdateAbilityInput() (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:99)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler:Update() (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:73)
 

Justin

Administrator
Staff member
Can you list the steps to reproduce from a fresh project? I have not been able to reproduce either of those issues.
 

Saddam Khan

New member
Yes. If you can just go to the basic demo multiplayer scene. Run the first instance and then the second, after that get the second player to pick up bow and start shooting. You will see that their is proper delay when the player fires the arrow
 

Justin

Administrator
Staff member
Are you running the latest version in a fresh project? I just tried to reproduce this but wasn't able to. This is a video of my client instance:

 

Justin

Administrator
Staff member
Ahh, I see what happened. The problem related to spawning the projecting and then a new client joining. You can fix this by changing line 39 of PunProjectile to:

Code:
            m_SpawnData[8] = m_Originator != null ? m_Originator.GetCachedComponent<PhotonView>().ViewID : -1;
 

Justin

Administrator
Staff member
I am not able to reproduce the arrow spawning in a random location. Are you getting any errors? It looks like in your video you need to update the input mapping.. maybe that is related.
 

Justin

Administrator
Staff member
I was able to reproduce the arrow disappearing, but not spawning in a random location. This has been fixed in the next update and was caused by switching the first and third person view.
 

Justin

Administrator
Staff member
This fix is in the latest version of the controller. Let me know how to reproduce it if you are still seeing it in a fresh project.
 

Saddam Khan

New member

Here is the video after update. You can see clearly when two or more players are connected.Arrows Behave weirdly.
To reproduce: Just connect two instances and try shooting arrows at each other for sometime, you will see.
 
Top