public void SetupSimData(PhysXRigidBody attachedRigidBody, IntPtr wheelSimData, int wheelNum, uint vehicleId) { if (autoCalculateSpringStrength) { float sprungMass = PhysXLib.GetSuspensionSprungMass(suspension); suspensionSpringStrength = (Physics.gravity.magnitude * sprungMass) / (suspensionDistance * (1 - suspensionSpringTargetPosition)); } this.wheelNum = wheelNum; this.attachedRigidBody = attachedRigidBody; Transform bodyParent = attachedRigidBody.transform; PhysXVec3 wheelCentrePos = new PhysXVec3(bodyParent.InverseTransformPoint(transform.TransformPoint(wheelCentre))); PhysXVec3 forceAppPos = new PhysXVec3(bodyParent.InverseTransformPoint(transform.TransformPoint(wheelCentre + forceAppPoint))); PhysXLib.SetWheelSimForceAppPoint(wheelSimData, wheelNum, forceAppPos); PhysXLib.SetWheelSimWheelCentre(wheelSimData, wheelNum, wheelCentrePos); PhysXLib.SetWheelSimWheelData(wheelSimData, wheelNum, wheel); PhysXLib.SetWheelSimTireData(wheelSimData, wheelNum, tire); PhysXLib.SetWheelSimSuspensionData(wheelSimData, wheelNum, suspension, new PhysXVec3(-transform.up)); PhysXLib.SetWheelSimWheelShape(wheelSimData, wheelNum, -1); PhysXLib.SetWheelSimQueryFilterData(wheelSimData, wheelNum, 0, 0, 0, vehicleId); }