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

Aperta
#7,341 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
javascript

Direzione di ricerca

Inizia con la scena Repro minima, concentrandoti sulla configurazione del tween e sulla scrittura imperativa della posizione in scene.update(). Riproduci il problema con Phaser 4.2.1 usando il renderer WebGL e confronta il caso angolo più movimento con i casi di controllo nella matrice di riproduzione, inclusa la variante Container/child Image. Il lavoro è completo quando gli sprite in movimento vengono renderizzati senza cunei, sezioni spostate o altra corruzione geometrica mentre è in esecuzione il tween dell’angolo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
JavaScript
Stelle
40.7k
Fork
7.2k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di phaserjs/phaser

Tutte le issue di phaserjs/phaser

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.