Script class can't be found

// 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

by user 883276031048441917

three.js Is this file in the modules?

by user 883276031048441917

Its a theejs sample script that you have to import as in the code above
https://threejs.org/docs/#examples/en/controls/FlyControls

See line two in the script here

You can just copy paste the entire thing into your file.

what I did copy your file into my script file then changed the rollSpeed to the 0 this is what I understood .

by user 883276031048441917

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.

This is worked but it canceled the Arrow Keys also I want them

by user 883276031048441917

If you want to go even deeper in terms of customization you can

  1. copy the FlyControls of three.js (e.g. download here) three.js/examples/jsm/controls/FlyControls.js at 1c32bbd627ba9a048f94068fc14ca34b02e68520 · mrdoob/three.js · GitHub
  2. Make a new file called MyFlyControls.js next to CustomFlyControls.ts
  3. paste the code, and rename the class to “MyFlyControls”
  4. in CustomFlyControls, change
    import { FlyControls as ThreeFlyControls } from "three/examples/jsm/controls/FlyControls.js";`` to import { MyFlyControls as ThreeFlyControls } from “./FlyControls.js”;`
    FlyControls.js

this is for q and e and I want to cancel them

by user 883276031048441917

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.

I will follow your steps and see what can I do

by user 883276031048441917

Really, thank you

by user 883276031048441917

Hi!

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

by user 883276031048441917

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 did this but in console I got Cannot set properties of undefined (setting 'Camera')

by user 883276031048441917

At which line?

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
FlyControls.js

by user 883276031048441917

I hope I was able to convey the idea

by user 883276031048441917

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)