Skip to content

How do I pass Enable3D the canvas I want it to use? #383

Closed Answered by Penumbra69
Penumbra69 asked this question in Help / Questions
Discussion options

You must be logged in to vote

I had to clone the repo and dig deeper into how Scene / Project interact, and I was able to determine that I didn't need a <canvas> object as much as I needed to tell the Project who my daddy was (parent: ).

For posterity .. After a bunch of trial and error, in an application where you want to specifically position your 3D window inside of a web page, you just need to have a parent in the DOM to align it to:

index.html:
<div id="game"></div>

Then when you are about to realize the physics engine, pass in the parent as a configuration:

      const config = { scenes: [Enable3DScene], parent: "game" }
      PhysicsLoader('/lib', () => new Project(config))

Thanks!
P

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Penumbra69
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant