From 9fde0f5b2618404845cdefbbb151eee8219b8233 Mon Sep 17 00:00:00 2001 From: luboslenco Date: Tue, 10 Jul 2018 22:43:09 +0200 Subject: [PATCH] Camball rotate restrict --- Sources/arm/CamBall.hx | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Sources/arm/CamBall.hx b/Sources/arm/CamBall.hx index 909069f6..491f0bb6 100644 --- a/Sources/arm/CamBall.hx +++ b/Sources/arm/CamBall.hx @@ -33,13 +33,20 @@ class CamBall extends Trait { if (mouse.down("right") || (mouse.down("left") && kb.down("control"))) { UITrait.inst.dirty = true; - // Rotate - object.transform.rotate(new Vec4(0, 0, 1), mouse.movementX / 100); - object.transform.buildMatrix(); - var v = object.transform.right(); - v.normalize(); - object.transform.rotate(v, mouse.movementY / 100); - object.transform.buildMatrix(); + + // Rotate X + if (!kb.down("alt")) { + object.transform.rotate(new Vec4(0, 0, 1), mouse.movementX / 100); + object.transform.buildMatrix(); + } + + // Rotate Y + if (!kb.down("shift")) { + var v = object.transform.right(); + v.normalize(); + object.transform.rotate(v, mouse.movementY / 100); + object.transform.buildMatrix(); + } } } }