Transform synchronization

Hello to everyone, Sorry for my bad english,

I am working on car racing game using photon network.In the offline scene i'm changing the wheel of the car and spawn in the online scene everything is fine but car wheel trasnform looks different between two cars camera.What can be the problem.?

Car 1 camera ;

https://i.hizliresim.com/JZEG1o.png

Car 2 camera;

https://i.hizliresim.com/7a8LzW.png

Player instantate code ;

[PunRPC]
void AddPlayer()
{
RCC_CarControllerV3 testArac;

GameObject[] point = GameObject.FindGameObjectsWithTag("spawnpoint");
int spawPointindex = UnityEngine.Random.Range(0, point.Length);
testArac= PhotonNetwork.Instantiate(playerPrefabs[selectedIndex].name, point[spawPointindex].transform.position, point[spawPointindex].transform.rotation, 0).GetComponent();



RCC.RegisterPlayerVehicle(testArac);
RCC.SetControl(testArac, true);

if (RCC_SceneManager.Instance.activePlayerCamera)
RCC_SceneManager.Instance.activePlayerCamera.SetTarget(testArac.gameObject);

RCC_CustomizerExample.Instance.LoadStats();

if (PlayerPrefs.HasKey(testArac.name))
{
RCC_Customization.ChangeWheels(RCC_SceneManager.Instance.activePlayerVehicle, RCC_ChangableWheels.Instance.wheels[RCC_CustomizerExample.Instance.tekerID].wheel);
}


}

Change wheel code ;

public static void ChangeWheels(RCC_CarControllerV3 vehicle, GameObject wheel){

if (!CheckVehicle (vehicle))
return;

for (int i = 0; i < vehicle.allWheelColliders.Length; i++) {

if (vehicle.allWheelColliders [i].wheelModel.GetComponent ())
vehicle.allWheelColliders [i].wheelModel.GetComponent ().enabled = false;

foreach (Transform t in vehicle.allWheelColliders [i].wheelModel.GetComponentInChildren ())
t.gameObject.SetActive (false);

GameObject newWheel = (GameObject)Instantiate (wheel, vehicle.allWheelColliders[i].wheelModel.position, vehicle.allWheelColliders[i].wheelModel.rotation, vehicle.allWheelColliders[i].wheelModel);

if (vehicle.allWheelColliders [i].wheelModel.localPosition.x > 0f)
wheel.transform.localScale = new Vector3 (wheel.transform.localScale.x * -1f, wheel.transform.localScale.y, wheel.transform.localScale.z);

}

OverrideRCC (vehicle);

}

Best Answer

Answers