Skip to content

Commit

Permalink
🐛 fix: Fix wheel visual positions
Browse files Browse the repository at this point in the history
  • Loading branch information
esnya committed May 27, 2022
1 parent 269be31 commit 68db0c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ private void Start()
var visual = (wheelVisuals != null && i < wheelVisuals.Length) ? wheelVisuals[i] : null;
if (visual != null)
{
wheelVisualPositionOffsets[i] = wheelTransform.InverseTransformPoint(visual.position) + Vector3.up * wheel.suspensionDistance * wheel.suspensionSpring.targetPosition;
var wheelVisual = wheelVisuals[i];
Vector3 wheelPosition;
Quaternion wheelRotation;
wheel.GetWorldPose(out wheelPosition, out wheelRotation);
wheelVisualPositionOffsets[i] = transform.InverseTransformVector(wheelVisual.position - wheelPosition);
wheelVisualLocalRotations[i] = visual.localRotation;
wheelVisualAxiesRight[i] = visual.InverseTransformDirection(Vector3.Project(vehicleRight, wheelTransform.right).normalized);
wheelVisualAxiesUp[i] = visual.InverseTransformDirection(Vector3.Project(vehicleUp, wheelTransform.up).normalized);
Expand Down

Large diffs are not rendered by default.

0 comments on commit 68db0c1

Please sign in to comment.