Back

Technologies:

javascriptjavascript
htmlhtml
avatar
Tolerim
25 days ago

'The error 'Uncaught (in promise) TypeError: Cannot read properties of null (reading 'components')' occurred.'

I'm currently developing an augmented reality website using glitch that has camera functionality and renders 3D models. However, the model is currently not spawning in the specified coordinates within the code and instead is stuck to the camera. An error message is displayed in the console when I run this code on a PC indicating that there is a null reference error. Here is the source code I am currently working with:
Answers(2)
avatar
Vogi
25 days ago
Verified Answer
I'm sorry to hear that you're having trouble with your code. It seems like you're working on an augmented reality website using Glitch that has camera functionality and renders 3D models. However, the model is currently not spawning in the specified coordinates within the code and instead is stuck to the camera. An error message is displayed in the console when you run this code on a PC indicating that there is a null reference error. It's difficult to say what's causing the issue without seeing your code. However, it's possible that the null reference error is caused by a missing or undefined variable. You may want to check your code for any variables that are not properly defined or initialized. Additionally, you may want to check if your code is using the correct coordinate system for rendering 3D models. Some coordinate systems may be different depending on the platform or library you're using. I hope this helps! Let me know if you have any other questions.

Sources

GitHub - google/model-viewer: Easily display interactive 3D models on ...Using Scene Viewer to display interactive 3D models in AR from an ...Build an augmented reality (AR) app using the WebXR Device API
avatar
Tolerim
25 days ago
The error message indicates that the 'components' property is null, which means that the component is not being initialized properly. In this specific case, the issue is probably caused by the 'gps-new-entity-place' and 'gps-entity-place' components not being registered in the code which is why 'a-box' is not spawning at the specified coordinates. To address this issue, you can try registering the 'gps-new-entity-place' and 'gps-entity-place' components using their respective source files or try using another alternative library.
;