Closed benloh closed 1 year ago
added 1 commit
requested review from @jdanish
In GitLab by @jdanish on Sep 14, 2022, 14:36
I think we need the video on the back layer so that we can move things around, etc. But I'll verify with Noel once I can test.
added 3 commits
added 3 commits
added 2 commits
added 1 commit
added 1 commit
added 1 commit
added 1 commit
marked the checklist item Figure out how to set alpha on background sprites so video will show through as completed
marked the checklist item initScript
works, but not setting it in blueprint as completed
marked the checklist item @jdanish Decide if having video on back layer is OK (e.g. you have to adjust background sprites), or if you want video on the top layer and give up the ability to select and interact with the agents. as completed
@jdanish Setting the alpha property in the blueprint for any background sprites does actually work. You just need to keep in mind that hovering over any sprite makes it opaque. This was necessary to make the selection outline be visible.
So if this works for Noel, this PR should be ready.
In GitLab by @jdanish on Sep 15, 2022, 15:20
Awesome. He should be testing it soon.
added 1 commit
added 1 commit
added 2 commits
dev-next
Merging.
mentioned in commit b8fd6b8369e9f3df4e6eca5792b68cff1df8204d
Merges dev-bl/webcam -> dev-next
WebCam
This adds a background div behind the simulation render with a video stream from a camera attached to the server.
Currently only tested on Chrome. You'll need to allow permissions to access the camera. You should be able to select the camera source using Chrome's "Privacy and security" > "Site settings" > "Camera".
Activating
The "WebCam" checkbox on Main (navbar) will turn the camera on and off.
Calibration
When the camera is on, you can use the sliders to change:
Mirroring (horizontal/vertical) The settings are saved immediately to the project file and will be loaded the next time you load the project. (This includes the webcam on/off status).
Because each project can specify its own simulation world size (aka "boundaries"), the webcam settings are specific to each project. This means that you will need to load and adjust the camera for each game. Advanced users can just copy and paste the relevant metadata values from one project to another if the projects are the same size. If the projects are not the same size, the mappings may be off.
How It Works
Basically this works by adding a
PanelSimulation places the video canvas behind the simulation. This is necessary so that the agent instances remain selectable by the mouse.
Project Design Considerations
The layering of the video UNDERNEATH the simulation layer means that the simulation layer needs to be transparent. This has some serious implications for project design:
To Test
npm run gem
The user denied permission to access the web camera.
in the web console, then you did not enable the camera correctly.If you want to test background sprites, currently the solution is to edit the initScript for the background sprite, adding the line:
prop alpha setTo 0.5
. For some reason setting it in the blueprint does not currently work. Looking into that.Known Issues / To Do
initScript
works, but not setting it in blueprint