Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

ecctrlRef.current.translation() causes null pointer

Aperta
#53 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
react
Ambito
frontend, game-dev

Direzione di ricerca

Inizia riproducendo il problema con il componente Respawn mostrato nel report e analizza il ciclo di vita di ecctrlRef in relazione a useFrame e translation(). Traccia il momento in cui l’oggetto fisico referenziato diventa non valido, quindi verifica che il comportamento di respawn non emetta più l’errore di puntatore nullo.

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

Descrizione

Here's my component:

import { useFrame } from '@react-three/fiber'

const Respawn = ({ ecctrlRef, setPos, levelPos }) => {
  useFrame(() => {
    if (ecctrlRef.current) {
      try {
        const { y } = ecctrlRef.current.translation()
        if (y < 0) {
          // this random hack ensures position is reset
          setPos(levelPos.map(a => a + Math.random() * 0.02 - 0.01))
        }
      } catch (err) {
        console.warn('error in getting ecctrl translation', err)
      }
    }
  })
  return null
}

export { Respawn }

And I'm getting this in the console:

Respawn.jsx:13 error in getting ecctrl translation Error: null pointer passed to rust
    at I3.wbg.__wbindgen_throw (chunk-GZS6NCTV.js?v=4fa056a0:2477:13)
    at 0057ee2e:0x14f24a
    at 0057ee2e:0x14f257
    at 0057ee2e:0x11b55b
    at _AA.rbTranslation (chunk-GZS6NCTV.js?v=4fa056a0:1811:18)
    at lA.translation (chunk-GZS6NCTV.js?v=4fa056a0:2650:26)
    at Object.current (Respawn.jsx:7:41)
    at render$1 (chunk-PEHQA6ZE.js?v=4fa056a0:17451:22)
    at loop (chunk-PEHQA6ZE.js?v=4fa056a0:17474:19)

The player does respawn in the level so the code works mostly, but it's strange it's throwing the null pointer error.

Thanks.

Lingua principale
TypeScript
Stelle
796
Fork
98
Merge medio
8m
PR unite (30g)
1

Preparare l'ambiente

Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 pmndrs/ecctrl

Tutte le issue di pmndrs/ecctrl

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.