Closed weypro closed 2 years ago
hi @weypro - Have a look here. You don't need to export SceneWithSpinningBoxes unless it's in a different file. https://codesandbox.io/s/epic-darwin-tohk0?file=/src/App.tsx
Yes, I think exporting SceneWithSpinningBoxes
doesn't affect the result. Actually, I find the truth that the canvas size must be defined like this:
#babylon-canvas {
width: 80%;
height: 80%;
}
Otherwise the size may be 'infinite' and make the WebGL engine crash.
By the way, the canvas id is babylonJS
in the JSX example in README.md
while it's babylon-canvas
in the TSX example. I think it's better to use the same id.
You make a good point in that by default it is not intuitive that CSS is needed to size the canvas - if you don't pass in props. I will be addressing this in the new documentation site and will keep in mind when updating the examples. Thanks for sharing. I'm going to close, but if you have a code proposal for this library then please re-open to discuss.
Hi. I created a new react project
and added babylonjs with the command:
After initializing the project, I tried to run the SpinningBox Example and make some changes:
export const SceneWithSpinningBoxes = ( ) => (
After:const SceneWithSpinningBoxes = () => (
After:
The code was compiled successfully, but nothing displayed on the page.