From bce96b0c4a72fc872c7477691b2aceece71aa274 Mon Sep 17 00:00:00 2001 From: Karl Pannek Date: Sat, 19 Jul 2025 00:35:21 +0200 Subject: [PATCH] Fix circular offset --- app/Game/Client/Control/Inputs/KeyboardAndMouse.js | 2 +- app/Game/Client/GameObjects/Item.js | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/Game/Client/Control/Inputs/KeyboardAndMouse.js b/app/Game/Client/Control/Inputs/KeyboardAndMouse.js index 50af8a1..46f33f8 100644 --- a/app/Game/Client/Control/Inputs/KeyboardAndMouse.js +++ b/app/Game/Client/Control/Inputs/KeyboardAndMouse.js @@ -222,7 +222,7 @@ function (Parent, KeyboardInput, domController, Settings, Swiper) { KeyboardAndMouse.prototype.deactivateModifier = function() { this.modifier = false; this.x = this.lastLookDirection * Settings.VIEWPORT_LOOK_AHEAD; - this.y = 0; + this.y = this.y; this.onXyChange(this.x, this.y); this.playerController.deactivateModifier(); }; diff --git a/app/Game/Client/GameObjects/Item.js b/app/Game/Client/GameObjects/Item.js index 9e036d3..6b01cf6 100755 --- a/app/Game/Client/GameObjects/Item.js +++ b/app/Game/Client/GameObjects/Item.js @@ -33,6 +33,16 @@ function (Parent, Settings, nc, Layer) { nc.trigger(nc.ns.client.view.mesh.add, self.layerId, mesh); } + // Determine pivot point based on item type + var pivotY; + if (this.options.type === "circle") { + // For circular items, center the pivot + pivotY = this.options.height / 2; + } else { + // For rectangular items, pivot at bottom center + pivotY = this.options.height; + } + nc.trigger(nc.ns.client.view.mesh.create, this.layerId, texturePath, @@ -42,7 +52,7 @@ function (Parent, Settings, nc, Layer) { height: this.options.height, pivot: { x: this.options.width / 2, - y: this.options.height + y: pivotY } } );