Incorrect pointer worldX/Y when polling.
Maintainer thường phản hồi trong vòng 3 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, typescript
- Lĩnh vực
- game-dev
Hướng nghiên cứu
Run the pasted scene and compare the two log lines to confirm that only the polled worldX/worldY are missing the camera scroll. Then follow how the Pointer's worldX/worldY properties get set on pointer movement versus what the pointerdown event path does (it applies the camera transform), and make the polled values use the same camera-aware conversion. Done means both logs agree for a scrolled camera, checked with this.cameras.main.setScroll(...) as in the example.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
- Phaser Version: 4.2.1
- Operating system: any
Description
Pointer world coordinates are incorrect when polling, but correct when listening to event. The difference is, that when polling, camera scrollX/Y is not counted in.
Example Test Code
This is minimal test code. It moves the center of the world into the screen center. Then, when you click on screen it will log worldX/Y from event and also do a single poll in an update.
export class Test extends Phaser.Scene {
private _logPosition: boolean = false;
public create() {
// focus on center
this.cameras.main.setScroll(-this.scale.width / 2, -this.scale.height / 2);
// hang on event
this.input.on(Phaser.Input.Events.POINTER_DOWN, (pointer: Phaser.Input.Pointer) => {
console.log(`Event: pointer id: ${pointer.id}, worldX: ${pointer.worldX}, worldY: ${pointer.worldY}`);
this._logPosition = true;
});
}
public override update(): void {
// poll
if (this._logPosition) {
console.log(`Polling: pointer id: ${this.input.activePointer.id}, worldX: ${this.input.activePointer.worldX}, worldY: ${this.input.activePointer.worldY}`);
this._logPosition = false;
}
}
}
If you click more or less into the center of the screen, you will get something close to this (depends on game size - mine is 800x1280. The world center is moved into the screen center, so the difference is 400 for x and 640 for y):
Event: pointer id: 0, worldX: -5.774434713492724, worldY: 10.586466165413526
Polling: pointer id: 0, worldX: 394.5864661654135, worldY: 650.5864661654135
The first line is from event (close to center). The second one is relative from top left corner (not taking into account camera.scrollX/Y).
- Ngôn ngữ chính
- JavaScript
- Star
- 40.7k
- Fork
- 7.2k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của phaserjs/phaser
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Type definition for TilemapLayer.getTileAt is wrongCó thể đã có người làm @hkbughk đã nhận 34 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Shader.preDestroy leaks its ShaderQuad's vertex buffer and VAO on every create/destroy cycle (4.2.1)Có thể đã có người làm @k1epg01ng129-eng đã nhận 32 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Black opaque background on transparent Phaser.Text textures in Phaser 4.2.1 on older iOS WebGLCó thể đã có người làm @SamuelMalmfors đã nhận 14 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
phaserjs/phaser#7392 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của phaserjs/phaser
Issue tương tự
-
enhancement ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
DCGM/semant-demo#708 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
agents area: runtime automation chore cli consistency dependencies developer-experience difficulty: easy documentation enhancement good first issue help wanted hygiene json-output priority: P3 starters tests
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Client codegen: an import repeated in an impl file is emitted twice, and the browser rejects the moduleCó thể đã có người làm @MalithaPrabhashana đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
jaseci-labs/jac#10756 ·
Maintainer thường phản hồi trong vòng 1 ngày