mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-10 06:34:16 +00:00
fix sync for detached vehicle parts
This commit is contained in:
parent
89310d9394
commit
847d5186da
1 changed files with 13 additions and 0 deletions
|
@ -130,6 +130,19 @@ namespace SanAndreasUnity.Net
|
|||
|
||||
var rb = this.GetComponentInChildren<Rigidbody>();
|
||||
|
||||
// Because first sync will send position/rotation for this transform, we need to assign it's
|
||||
// position/rotation to the child's transform, which is the transform that will be synced from
|
||||
// now on. We do this to maintain same behaviour as on server.
|
||||
|
||||
if (rb != null)
|
||||
{
|
||||
rb.transform.localPosition = this.transform.localPosition;
|
||||
rb.transform.localRotation = this.transform.localRotation;
|
||||
}
|
||||
|
||||
this.transform.localPosition = Vector3.zero;
|
||||
this.transform.localRotation = Quaternion.identity;
|
||||
|
||||
this.NetworkTransform.ChangeSyncedTransform(rb != null ? rb.transform : null);
|
||||
|
||||
if (rb != null)
|
||||
|
|
Loading…
Reference in a new issue