v4.2.1 WebGL: sprite batch corruption when an angle tween runs on a GameObject whose position is also written every frame

Đang mở
#7,341 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
javascript

Hướng nghiên cứu

Bắt đầu với scene Repro tối thiểu, tập trung vào thiết lập tween và thao tác ghi vị trí theo mệnh lệnh trong scene.update(). Tái hiện với Phaser 4.2.1 bằng renderer WebGL và so sánh trường hợp góc cộng chuyển động với các trường hợp đối chứng trong ma trận tái hiện, bao gồm cả biến thể Container/child Image. Được xem là hoàn tất khi các sprite đang di chuyển được render mà không có các hình nêm, các lát bị lệch hoặc lỗi hình học nào khác trong khi tween góc đang chạy.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Version

  • Phaser 4.2.1 ("Giedi"), WebGL renderer (type: AUTO)
  • Observed on Linux, Chromium 149 (Playwright headless shell) — also reproduced through several independent scene setups in the same environment. Not yet verified in headed browsers.

Description

When a GameObject has a continuous angle tween running while its position is written imperatively every frame (in scene.update()), sprites in the scene render with corrupted geometry: wedge-shaped chunks missing, or the quad drawn as displaced slices — it looks like one vertex/triangle of the sprite's quad (or its UVs) is wrong for a frame.

Either behavior alone renders perfectly. The combination corrupts.

Reproduction matrix (all with 152×136 PNG textures)

angle position result
static (0° or any fixed angle) written every frame in update() ✅ renders fine
tweened (yoyo/repeat: -1) static ✅ renders fine
tweened written every frame ❌ corrupted (wedges/slices)

The corruption also reproduces when the moving object is a Container and the angle tween targets a child Image (container position written per frame, child angle tweened).

Minimal repro sketch

class Repro extends Phaser.Scene {
    create() {
        this.img = this.add.image(400, 300, 'anyTexture');
        this.tweens.add({
            targets: this.img,
            angle: { from: -4, to: 4 },
            duration: 1500,
            yoyo: true,
            repeat: -1,
        });
    }
    update(time, delta) {
        this.img.x += 20 * (delta / 1000);   // any imperative per-frame movement
        if (this.img.x > 900) this.img.x = 100;
    }
}

With the tween removed (or replaced by a scale/y tween), rendering is clean. With movement removed, rendering is clean.

Workaround

Express "float/wobble" effects on moving objects with scale or child-y tweens instead of angle tweens, or keep rotation static while moving. That fully avoids the artifacts.

Happy to provide screenshots of the corrupted frames or a fuller runnable repro if useful.

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

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của phaserjs/phaser

Tất cả issue của phaserjs/phaser

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.