-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vatsal Ambastha
committed
Sep 27, 2020
1 parent
5a1d823
commit fd3c1c3
Showing
4 changed files
with
432 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
using UnityEngine; | ||
|
||
using UnityEngine; | ||
|
||
namespace Adrenak.Tork { | ||
public static class Extensions { | ||
public static class Extensions { | ||
public static float GetCompressionRatio(this WheelCollider WheelL) { | ||
WheelHit hit; | ||
bool groundedL = WheelL.GetGroundHit(out hit); | ||
if(groundedL) | ||
return 1 - ((-WheelL.transform.InverseTransformPoint(hit.point).y - WheelL.radius) / WheelL.suspensionDistance); | ||
return 0; | ||
} | ||
|
||
} | ||
|
||
public static WheelHit GetHit(this WheelCollider WheelL) { | ||
WheelHit hit; | ||
bool groundedL = WheelL.GetGroundHit(out hit); | ||
return hit; | ||
} | ||
} | ||
|
||
public static float Evaluate(this WheelFrictionCurve curve, float slip) { | ||
if (slip < curve.extremumSlip) | ||
return slip * curve.extremumValue / curve.extremumSlip; | ||
else | ||
//return curve.asymptoteValue; | ||
return ((slip - curve.asymptoteSlip) * (curve.extremumValue - curve.asymptoteValue) / (curve.extremumSlip - curve.asymptoteSlip)) + curve.asymptoteValue; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.