Add option to sync vehicle transform using syncvars

This commit is contained in:
in0finite 2019-05-24 00:54:03 +02:00
parent 63435ad446
commit 9d0f0cfa0d
2 changed files with 7 additions and 2 deletions

View file

@ -42,6 +42,7 @@ namespace SanAndreasUnity.Behaviours.Vehicles
private void Awake()
{
//m_vehicle = GetComponent<Vehicle>();
this.GetComponent<NetworkTransform>().enabled = ! VehicleManager.Instance.syncVehicleTransformUsingSyncVars;
}
internal void OnAfterCreateVehicle()
@ -216,7 +217,8 @@ namespace SanAndreasUnity.Behaviours.Vehicles
if (NetStatus.IsServer)
return;
m_vehicle.RigidBody.MovePosition(pos);
if (VehicleManager.Instance.syncVehicleTransformUsingSyncVars)
m_vehicle.RigidBody.MovePosition(pos);
}
void OnNetRotationChanged(Quaternion rot)
@ -224,7 +226,8 @@ namespace SanAndreasUnity.Behaviours.Vehicles
if (NetStatus.IsServer)
return;
m_vehicle.RigidBody.MoveRotation(rot);
if (VehicleManager.Instance.syncVehicleTransformUsingSyncVars)
m_vehicle.RigidBody.MoveRotation(rot);
}
}

View file

@ -15,6 +15,8 @@ namespace SanAndreasUnity.Behaviours.Vehicles
public bool syncPedTransformWhileInVehicle = false;
public bool syncVehicleTransformUsingSyncVars = false;
void Awake()
{