From f7c4118871bb84fd691bf2b6fcd6b62df305669b Mon Sep 17 00:00:00 2001 From: freezy Date: Tue, 18 Jan 2022 21:40:42 +0100 Subject: [PATCH 1/3] playfield: Rotate to slope angle when starting game. --- .../VPT/Playfield/PlayfieldInspector.cs | 3 +++ .../VisualPinball.Unity/VPT/Playfield/PlayfieldComponent.cs | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Playfield/PlayfieldInspector.cs b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Playfield/PlayfieldInspector.cs index c6a8cb454..20e231017 100644 --- a/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Playfield/PlayfieldInspector.cs +++ b/VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Playfield/PlayfieldInspector.cs @@ -28,6 +28,7 @@ public class PlayfieldInspector : MainInspector private SerializedProperty _tableHeightProperty; private SerializedProperty _angleTiltMinProperty; private SerializedProperty _angleTiltMaxProperty; + private SerializedProperty _renderSlopeProperty; protected override void OnEnable() { @@ -39,6 +40,7 @@ protected override void OnEnable() _tableHeightProperty = serializedObject.FindProperty(nameof(PlayfieldComponent.TableHeight)); _angleTiltMinProperty = serializedObject.FindProperty(nameof(PlayfieldComponent.AngleTiltMin)); _angleTiltMaxProperty = serializedObject.FindProperty(nameof(PlayfieldComponent.AngleTiltMax)); + _renderSlopeProperty = serializedObject.FindProperty(nameof(PlayfieldComponent.RenderSlope)); } public override void OnInspectorGUI() @@ -59,6 +61,7 @@ public override void OnInspectorGUI() }); PropertyField(_angleTiltMinProperty, "Slope for Min. Difficulty"); PropertyField(_angleTiltMaxProperty, "Slope for Max. Difficulty"); + PropertyField(_renderSlopeProperty, "Rendered Playfield Angle"); base.OnInspectorGUI(); diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Playfield/PlayfieldComponent.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/Playfield/PlayfieldComponent.cs index 4c783cab1..ef0aea232 100644 --- a/VisualPinball.Unity/VisualPinball.Unity/VPT/Playfield/PlayfieldComponent.cs +++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Playfield/PlayfieldComponent.cs @@ -61,6 +61,9 @@ public class PlayfieldComponent : MainRenderableComponent public float AngleTiltMin = 6f; + [Tooltip("How much the playfield should be rotated during runtime (in edit time, we keep it horizontal)")] + public float RenderSlope = 3.6f; + public int PlayfieldDetailLevel = 10; public float GravityStrength = 1.762985f; @@ -102,6 +105,8 @@ private void Awake() if (meshComp) { World.DefaultGameObjectInjectionWorld.GetOrCreateSystem().CollideAgainstPlayfieldPlane = meshComp.AutoGenerate; } + + transform.RotateAround(Vector3.zero, Vector3.right, -RenderSlope); } public override IEnumerable SetData(TableData data) From 77c0283be09340f817a4f442585eb0d59fa3cc29 Mon Sep 17 00:00:00 2001 From: freezy Date: Tue, 18 Jan 2022 21:41:11 +0100 Subject: [PATCH 2/3] editor: Reduce wire inspector input field to 0-6. --- .../VisualPinball.Unity/VPT/Trigger/TriggerMeshComponent.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/VisualPinball.Unity/VisualPinball.Unity/VPT/Trigger/TriggerMeshComponent.cs b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trigger/TriggerMeshComponent.cs index 7ca3a396e..33b935277 100644 --- a/VisualPinball.Unity/VisualPinball.Unity/VPT/Trigger/TriggerMeshComponent.cs +++ b/VisualPinball.Unity/VisualPinball.Unity/VPT/Trigger/TriggerMeshComponent.cs @@ -33,8 +33,9 @@ public class TriggerMeshComponent : MeshComponent public int Shape; - [Min(0)] + [Range(0, 6)] [Tooltip("Thickness of the trigger wire. Doesn't have any impact on the ball.")] + public float WireThickness; #endregion From 59fb8dc828e307cefe4ebd46416b38ed1d65d960 Mon Sep 17 00:00:00 2001 From: freezy Date: Tue, 18 Jan 2022 21:52:43 +0100 Subject: [PATCH 3/3] doc: Update changelog. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f16fd730..981974371 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ Built with Unity 2021.2. - Native trough component ([#229](https://github.com/freezy/VisualPinball.Engine/pull/229), [#248](https://github.com/freezy/VisualPinball.Engine/pull/248), [#256](https://github.com/freezy/VisualPinball.Engine/pull/256), [Documentation](https://docs.visualpinball.org/creators-guide/manual/mechanisms/troughs.html)). ### Changed +- Playfield is now rotated to the correct angle during gameplay ([#370](https://github.com/freezy/VisualPinball.Engine/pull/370)) - Decouple light components from transformation override ([#350](https://github.com/freezy/VisualPinball.Engine/pull/350)). - Refactored drag points. They are nicely separated and typed now. - Collider debug view is now much faster and intuitive. It's also activated per default when there is no visible mesh.