Skip to content

Commit a56d03d

Browse files
committed
fix: Kicker widget orientation.
1 parent f2a875a commit a56d03d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Kicker/KickerInspector.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,20 @@ private void OnSceneGUI()
9797
}
9898

9999
Handles.color = Color.cyan;
100+
Handles.matrix = Matrix4x4.identity;
100101
var transform = MainComponent.transform;
101102
var localPos = MainComponent.GetEditorPosition();
102103
localPos.z = MainComponent.PositionZ;
103104

104-
var worldPos = transform.parent == null ? localPos : transform.parent.TransformPoint(localPos);
105+
var worldPos = transform.parent == null ? localPos : localPos.TranslateToWorld();
105106

106107
foreach (var coil in MainComponent.Coils) {
107108
var from = MainComponent.GetBallCreationPosition().ToUnityVector3();
108109
var l = coil.Speed == 0 ? 1f : 20f * coil.Speed;
109110
var dir = new Vector3(
110111
l * math.sin(math.radians(coil.Angle)),
111-
-l * math.cos(math.radians(coil.Angle)),
112-
l * math.sin(math.radians(coil.Inclination))
112+
l * math.sin(math.radians(coil.Inclination)),
113+
l * math.cos(math.radians(coil.Angle))
113114
);
114115
var to = from + dir;
115116
var worldDir = transform.TransformDirection(math.normalize( to - from));

0 commit comments

Comments
 (0)