Hello, I have started using MLAPI this week and have gained quite a bit of progress on my 2D game. Most of the functions that I want to be specific to the local player can be fixed with the IsLocalPlayer boolean. However I have reached a problem that has stumped me.
The goal is to have a platformer similar to Maplestory and hence players do not collide with one another and can overlap each other on the x and y plane. I would like to make the local player at the forefront perspective so naturally I coded it to push the player into the forefront by changing the z
void Awake()
{
z = this.gameObject.transform.position.z;
z -= 1f;
}
void Update()
{
if (!local) local = IsLocalPlayer;
else
{
this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, z); //this line makes sure the local player is always at the forefront relative to other players
Move(); // script to move my player
Track(); // script to move the camera
}
}
However I have a network transform component attached to the player which handles the x and y positions. I hence realize that no matter what Z I set, it will be sent across the server and eventually all players will have the same Z resulting in the engine not sure which player to place at the forefront resulting in a blend of alternating players at the forefront.
Anyone got any ideas to force the player to always be at the forefront relative to others? ( I could edit the NetworkTransform script but I would very much like to leave that intact and it is a final resort.)