mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-17 05:18:27 +00:00
sync y position of wheel
This commit is contained in:
parent
91bc7547a5
commit
f6fe21cbdb
2 changed files with 10 additions and 0 deletions
|
@ -29,6 +29,7 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
public float motorTorque;
|
||||
public float steerAngle;
|
||||
//public float travel;
|
||||
public float localPosY;
|
||||
}
|
||||
|
||||
class WheelSyncList : SyncList<WheelSyncData> { }
|
||||
|
@ -166,6 +167,7 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
motorTorque = wheel.Collider.motorTorque,
|
||||
steerAngle = wheel.Collider.steerAngle,
|
||||
//travel = wheel.Travel,
|
||||
localPosY = wheel.Collider.transform.GetChild(0).localPosition.y,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -189,6 +191,7 @@ namespace SanAndreasUnity.Behaviours.Vehicles
|
|||
w.Collider.motorTorque = data.motorTorque;
|
||||
w.Collider.steerAngle = data.steerAngle;
|
||||
//w.Travel = data.travel;
|
||||
w.Collider.transform.GetChild(0).SetLocalY(data.localPosY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -263,6 +263,13 @@ namespace SanAndreasUnity.Utilities
|
|||
t.position = pos;
|
||||
}
|
||||
|
||||
public static void SetLocalY(this Transform t, float yPos)
|
||||
{
|
||||
Vector3 pos = t.localPosition;
|
||||
pos.y = yPos;
|
||||
t.localPosition = pos;
|
||||
}
|
||||
|
||||
public static float Distance(this Transform t, Vector3 pos)
|
||||
{
|
||||
return Vector3.Distance (t.position, pos);
|
||||
|
|
Loading…
Add table
Reference in a new issue