From c17a7b7a77c66e2d39fe2ee47fe21d55886794d9 Mon Sep 17 00:00:00 2001 From: Nicolas Gerard <62284390+daimahou@users.noreply.github.com> Date: Thu, 5 Dec 2024 01:46:30 +0900 Subject: [PATCH] fix h2d.Object.move implementation (#1249) --- CHANGELOG.md | 3 +++ h2d/Object.hx | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec78c7feff..6032f594c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 2.0.1 (December, 3, 2024) +* fix h2d.Object.move method to perform local movement as intended + ## 2.0 (January 1, 2024) * changed h3d.Vector to be a 3 component vector (alias to h3d.col.Point), added h3d.Vector4 diff --git a/h2d/Object.hx b/h2d/Object.hx index 530ba5c286..fb286a87e2 100644 --- a/h2d/Object.hx +++ b/h2d/Object.hx @@ -1015,8 +1015,8 @@ class Object #if (domkit && !domkit_heaps) implements domkit.Model # Move the object by the specified amount along its current direction (`Object.rotation` angle). **/ public function move( dx : Float, dy : Float ) { - x += dx * Math.cos(rotation); - y += dy * Math.sin(rotation); + x += dx * Math.cos(rotation) - dy * Math.sin(rotation); + y += dx * Math.sin(rotation) + dy * Math.cos(rotation); } /**