|
Post by meudes on Feb 26, 2022 22:49:05 GMT
Hi, I watched this tutorial to integrate MLAPI :
I use the version ThirdPersonController - Shooter Template (v 2.6.1) I build the bridge, but I can't find the function to delete for the camera.
Any Ideas? Thanks.
|
|
|
Post by meudes on Mar 6, 2022 0:09:57 GMT
Hi, I tested many things but I remain with this camera problem.
I have 2 cameras: indeed I did not find the InitializeTpCamera function to delete. The one instantiated by the bridge does not have a correct target.
For the first : I tried to add in vThirdPersonCamera.Cs protected virtual void Start() { if (!IsLocalPlayer) return; Init(); } I tried to put a SetActive=false, I tried to destroy it in the bridge, but nothing works.
|
|
|
Post by meudes on Mar 9, 2022 22:38:18 GMT
Solution: My playerCamera is not active
// Start is called before the first frame update void Start() { if (!IsLocalPlayer) { GetComponent<vThirdPersonInput>().SetEnable(false); GetComponent<vShooterMeleeInput>().SetEnable(false); } else { GetComponent<vThirdPersonInput>().SetEnable(true); GetComponent<vShooterMeleeInput>().SetEnable(true);
playerCam = Instantiate(playerCamera); playerCam.SetActive(true); playerCam.name = "MainCamera_" + NetworkManager.Singleton.LocalClientId; vTPI = GetComponent<vThirdPersonInput>(); InitializeTpCamera(); } }
public virtual void InitializeTpCamera() { var tpCamera = playerCam.GetComponent<vThirdPersonCamera>();
if (tpCamera) { tpCamera.SetMainTarget(this.transform); tpCamera.Init(); } vTPI.tpCamera = tpCamera; }
|
|
|
Post by skechinballs on Mar 11, 2022 15:52:14 GMT
So what I found in testing, only with the basic locomotion though as I have not got to the point of fully testing combat yet is: since that video was posted the way the info script handles the camera has changed a little, a pretty simple fix for this is to leave the camera controls in the input script but in the IEnumerator CharacterInit() check if you are the authoritative player, if not just return. Continue to do the same in all of the update voids. This should leave you with one authoritative player for their inputs, with only one camera needed in scene and a bunch of "Dead" characters that can now simple be controlled with mirror's network animator and network tranforms on the gameobjects that need position or rotation sync. [syncvar]s will also need to be added for things like health in the base classes to sync those variables. npc/mobs should be pretty sraight forward with the build in ai, might need to also check if it's on the server before controlling to reduce chance of desync and apply the same network component the players needed.
|
|