The reason you don’t see the props being sent, is that they aren’t sent explicitly like by prop-drilling, which some consider an anti-pattern.
Engine component is a
Provider, which drops the engine object onto the context. The context was moved out of experimental and is a way to avoid prop-drilling.
So, to answer your question there are 2 ways.
- Use a “consumer” in code. The default export on scene takes care of automatically adding the consumer
export default withBabylonJS(Scene). So that is one way (you can see the HoC here: react-babylonjs/Engine.tsx at master · brianzinn/react-babylonjs · GitHub)
- You can use a hook.
https://github.com/brianzinn/react-babylonjs/blob/master/stories/babylonjs/3-physics/hooks.stories.js#L10 and there is a storybook story for that.
One thing that stands out is that when you don’t use the component that you won’t have:
- A canvas rendered
- No scene is created for SceneLoader, no canvas attached to scene and render loop not created.
The code to add models is not generated from the API, but hand coded. I think it would not be too much of a stretch to add scene loader as a new component for the library. The component uses it behind the scenes, so to speak (react-babylonjs/ModelLifecycleListener.ts at master · brianzinn/react-babylonjs · GitHub). I think it should work straight up with no changes to load a .babylon model - if your extension of your file doesn’t match then you can override it to use the correct loader. Are you loading an entire scene and want to use your own loading screen?
If you are just loading one model then maybe you can use:
<Model rootUrl='/assets/' sceneFileName='paradise.babylon' />
I have added custom properties like scaleToDimension, but you can use rotate, position as well. Let me know if you have any more questions and also always feel free to create an issue with any feature requests.