EditVector: Allow Disabling individual components

+ Disable XY-Angle when Entity has Rigidbody2D Component (This is something for future me, I couldn't figure it out...)
+ Start of handling of non trivial tranform nesting and rotations on XY axes
+ TranformComponent.RotationEuler: Normalize quaternion before converison
This commit is contained in:
Simon Lübeß
2023-09-05 23:14:51 +02:00
parent 2f58f0e142
commit cd333f4f02
4 changed files with 41 additions and 15 deletions
@@ -81,7 +81,7 @@ namespace GlitchyEditor.EditWindows
{
DrawComponenSceneGUI<PolygonCollider2DComponent>(entity, => ShowPolygonColliderSceneGUI);
}
static void ShowPolygonColliderSceneGUI(Entity entity, PolygonCollider2DComponent* collider)
{
for (int i < collider.VertexCount)
@@ -208,7 +208,16 @@ namespace GlitchyEditor.EditWindows
}
float3 rotationEuler = MathHelper.ToDegrees(transform.EditorRotationEuler);
if (ImGui.Editfloat3("Rotation", ref rotationEuler, .Zero, 0.1f, textWidth))
bool3 componentEditable = true;
if (entity.HasComponent<Rigidbody2DComponent>())
{
componentEditable.XY = false;
rotationEuler.XY = 0;
}
if (ImGui.Editfloat3("Rotation", ref rotationEuler, .Zero, 0.1f, textWidth, componentEnabled: componentEditable))
{
transform.EditorRotationEuler = MathHelper.ToRadians(rotationEuler);