Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ecctrlRef.current.translation() causes null pointer #53

Open
campbellgoe opened this issue Apr 25, 2024 · 1 comment
Open

ecctrlRef.current.translation() causes null pointer #53

campbellgoe opened this issue Apr 25, 2024 · 1 comment

Comments

@campbellgoe
Copy link

campbellgoe commented Apr 25, 2024

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.

@ErdongChen-Andrew
Copy link
Member

Other users have reported this issue, we thought it could be related to Rapier Ray. I'll need to do more tests to figure this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants