ESM Orbit Camera
Swaps the Orbit Camera out for the ESM version. If this get's approved I can generate the equivalent for all the other scripts.
There's a bigger discussion on discovery and how we can provide these to the user, but for now, this is a simple swap
- updating to esm attributes declarations
var->let/constattr:*events to getters/setters- callbacks to arrow functions where sensible
I confirm I have read the contributing guidelines and signed the Contributor License Agreement.
It'd be great to update one of the examples to use this, maybe cascaded shadow maps? It'd be great to see how it gets used.
Not sure about deleting orbit-camera.js - lots of engine examples use it?
It'd be great to update one of the examples to use this, maybe cascaded shadow maps? It'd be great to see how it gets used.
Yeah it should just be a case of doing
import { OrbrtCamera } from '/scripts/camera/orbit-camera.mjs'
entity.add(OrbitCamera)
unfortunately it's not easy to import things in the examples browser 😩
Not sure about deleting orbit-camera.js - lots of engine examples use it?
yeah I guess, we'd need to update everything in sync
I'm importing the script in the examples this way (from a different folder, but that's a good start for now) https://github.com/playcanvas/engine/pull/7011
Yeah ideally we only have scripts in one location. We don't really want to have a copy in the examples/misc
Agreed, for me that is THE location. But we need to surface those scripts to the Editor and that will change then.
These new scripts seem to not have name on them, will they still work when using scene loaders and referenced scripts by names (not class references)?
Please don't force people to switch by removing currently used scripts.
Please don't force people to switch by removing currently used scripts.
We do not want to maintain each script in two forms. We're planning to convert all (maybe apart from post-effects) scripts stored in the engine to the new format. People are welcome to use old format if they already have them in their project though. Those are 1:1 replacement though, so it should be easy for people to switch to new format? Or do you see some complications with this?
Yep creating using a name will work as long as the script is registered.
Or do you see some complications with this?
I don't think Editor has complete feature parity and similar level of UX yet to force such a switch. Previously any new systems would be provided as a more convenient option until devs decided to switch, without forcing by force-deprecating or removing features/code.
Curious to know what you think is missing?
At the moment the UX is to manually find a script and copy/paste it into the project. This could be much better, but for now it works and is identical workflow for both. An ESM script can be added to a project containing Classic scripts and vice-versa and it won't affect your existing scripts.
At the moment the UX is to manually find a script and copy/paste it into the project.
I personally prefer to import the orbit script from the store, so I don't need to search/copy/paste it. Can it be added there?
At the moment the UX is to manually find a script and copy/paste it into the project.
I personally prefer to import the orbit script from the store, so I don't need to search/copy/paste it. Can it be added there?
We're working on a way to surface engine provided scripts to the Editor, and the discussion is ongoing here. Stay tuned. Store is one way, but we're hoping for simply importing them from the "playcanvas" or similar.
This version of the orbit camera will be deprecated in favor of extending of the base camera defined in GH-6642 with the multi-camera
@marklundin This can be closed now since Orbit camera in included in GH-7111
YES!! 🙏