Setting Up Your First Scene
This tutorial shows you how to setup a scene like below. We teach you how to:
- [ ] Setup a vuer server
- [ ] Add a 3D scene to the server
- [ ] Add a SpotLight to the scene
- [ ] Add a Box to the scene
- [ ] Add a Movable component to move the box around
Vuer has two main components: the server and the client. You will interact with the 3D scene via the python vuer app.
We start by instantiating a vuer server.
Now, to start the vuer server, you can run:
And this generates the following output:
Note, app.run is blocking. In other words, this should be the last thing you run in your script.
Congratulations! Now you have a vuer server running locally.
Adding a 3D Scene
To add a 3D Scene, you neet to use the set operator to add a Scene object to the vuer app.
Before we do that, note that vuer client connects to the vuer python server via a websocket session. Each server can handle multiple sessions, which means that we need to wrap each session in an async function, where the life cyle of the session corresponds to the procedures inside this function:
Now at the end of your script, launch the app:
And this should give the scene shown at the beginning: