// pass settings through to the three.js FlyControls this._controls.rollSpeed = this.rollSpeed; this._controls.movementSpeed = this.movementSpeed; this._controls.dragToLook = this.dragToLook; I didn’t get this part
Once you copied the file and added it to an object in Unity, in the inspector you can edit these properties. No need to change them in the script file.
Make a new file called MyFlyControls.js next to CustomFlyControls.ts
paste the code, and rename the class to “MyFlyControls”
in CustomFlyControls, change import { FlyControls as ThreeFlyControls } from "three/examples/jsm/controls/FlyControls.js";`` to import { MyFlyControls as ThreeFlyControls } from “./FlyControls.js”;`
What you want to do is customize the script beyond what can be customized out of the box.
You’ll need to follow the steps above and then you have full control and can change the code however you like.
Can I ask about how can I get access to the camera when I was using vanilla JavaScript with three.js I declared like this camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight,1,1000 ); and then I pass it as a parameter that I used in the FlyControls file but here the camera is already there in unity so I want to access it but I don’t how I searched in the unity documentation how can I access it but I didn’t get any result
You can access the current main camera with this.context.mainCamera (or this.context.mainCameraComponent if you want to get the Needle Engine camera component)
I created a function in this file what this function should do is track specific path so I need to copy the camera position at every point in the path I want to access that camera in the scene to make it track that path
I dont see where/how you use this.context in this file - this.context is available on a Needle Engine component/Behaviour class. Please show the code where you try to access the camera (and which function you call - “A function in this file” with 300 lines of code is a bit too unspecific)