What is the equivalent to these apis in legacy script?

I’m trying to convert orbit-camera.js in the starter project to the legacy-scrpit-written one.

My problem is I can’ find the equivalent to this.app.graphicsDevice.height and this.app.root in legacy script.

One possible api is pc.GraphicsDevice.prototype.height, but it brings an error.

Could anyone plz give me any ideas? Thx

It’s quite simple:

this.app.graphicsDevice.height -> app.graphicsDevice.height

And:

this.app.root -> app.root

In the legacy scripting system, a script is wrapped with:

pc.script.create('myscript', function (app) {
    // Your script definition
});

So app is accessible ‘globally’ within that script closure.

In the new scripting system, the app is a property on the script object, so you have to access it via this.app