diff --git a/Source/Engine/Physics/D6Joint.cs b/Source/Engine/Physics/D6Joint.cs index a37cf01f4..f5f434b8f 100644 --- a/Source/Engine/Physics/D6Joint.cs +++ b/Source/Engine/Physics/D6Joint.cs @@ -1,5 +1,7 @@ // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. +using System.ComponentModel; + namespace FlaxEngine { partial struct D6JointDrive @@ -24,4 +26,59 @@ namespace FlaxEngine Acceleration = acceleration; } } + partial class D6Joint + { +#if FLAX_EDITOR + internal struct D6JointAxisMotion + { + [EditorOrder(0), DefaultValue(D6JointMotion.Locked)] + [Tooltip("Movement on the X axis.")] + public D6JointMotion X; + + [EditorOrder(1), DefaultValue(D6JointMotion.Locked)] + [Tooltip("Movement on the Y axis.")] + public D6JointMotion Y; + + [EditorOrder(2), DefaultValue(D6JointMotion.Locked)] + [Tooltip("Movement on the Z axis.")] + public D6JointMotion Z; + + [EditorOrder(2), DefaultValue(D6JointMotion.Locked)] + [Tooltip("Rotation around the X axis.")] + public D6JointMotion Twist; + + [EditorOrder(4), DefaultValue(D6JointMotion.Locked)] + [Tooltip("Rotation around the Y axis."), EditorDisplay(null, "Swing Y")] + public D6JointMotion SwingY; + + [EditorOrder(5), DefaultValue(D6JointMotion.Locked)] + [Tooltip("Rotation around the Z axis."), EditorDisplay(null, "Swing Z")] + public D6JointMotion SwingZ; + } + + [ShowInEditor, Serialize, EditorOrder(100), EditorDisplay("Joint")] + [Tooltip("Joint motion options (per-axis).")] + internal D6JointAxisMotion AxisMotion + { + get => new D6JointAxisMotion + { + X = GetMotion(D6JointAxis.X), + Y = GetMotion(D6JointAxis.Y), + Z = GetMotion(D6JointAxis.Z), + Twist = GetMotion(D6JointAxis.Twist), + SwingY = GetMotion(D6JointAxis.SwingY), + SwingZ = GetMotion(D6JointAxis.SwingZ) + }; + set + { + SetMotion(D6JointAxis.X, value.X); + SetMotion(D6JointAxis.Y, value.Y); + SetMotion(D6JointAxis.Z, value.Z); + SetMotion(D6JointAxis.Twist, value.Twist); + SetMotion(D6JointAxis.SwingY, value.SwingY); + SetMotion(D6JointAxis.SwingZ, value.SwingZ); + } + } +#endif + } } diff --git a/Source/Engine/Physics/Joints/D6Joint.h b/Source/Engine/Physics/Joints/D6Joint.h index 7274ae503..3debd5368 100644 --- a/Source/Engine/Physics/Joints/D6Joint.h +++ b/Source/Engine/Physics/Joints/D6Joint.h @@ -40,6 +40,7 @@ API_ENUM() enum class D6JointAxis /// SwingZ = 5, + API_ENUM(Attributes="HideInEditor") MAX }; @@ -63,6 +64,7 @@ API_ENUM() enum class D6JointMotion /// Free, + API_ENUM(Attributes="HideInEditor") MAX }; @@ -113,6 +115,7 @@ API_ENUM() enum class D6JointDriveType /// Slerp = 5, + API_ENUM(Attributes="HideInEditor") MAX }; diff --git a/Source/Engine/Physics/Joints/Limits.h b/Source/Engine/Physics/Joints/Limits.h index 336f74ac2..20c047cb0 100644 --- a/Source/Engine/Physics/Joints/Limits.h +++ b/Source/Engine/Physics/Joints/Limits.h @@ -330,12 +330,12 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(LimitConeRange); /// /// The Y angle of the cone (in degrees). Movement is constrained between 0 and this angle on the Y axis. /// - API_FIELD() float YLimitAngle = 90.0f; + API_FIELD(Attributes="Limit(0.0f, 180.0f)") float YLimitAngle = 90.0f; /// /// The Z angle of the cone (in degrees). Movement is constrained between 0 and this angle on the Z axis. /// - API_FIELD() float ZLimitAngle = 90.0f; + API_FIELD(Attributes="Limit(0.0f, 180.0f)") float ZLimitAngle = 90.0f; public: