Hi I want to Understand the logic of how I find components inside needle I read the document but I canât understand
like in Three.js I use this âthree/examples/jsm/controls/OrbitControlsâ; how I have to get these from needle
Hey!
Could you make an example of what you try to do?
You can use any other npm module / package just like before - so your importing three/examples/jsm/controls/OrbitControl from three examples in one of your typescript scripts will still work just the same.
For example our OrbitControls component does also import the three OrbitControls code.
import { Behaviour, GameObject } from "./Component";
import { Camera } from "./Camera";
import { OrbitControls as ThreeOrbitControls } from "three/examples/jsm/controls/OrbitControls";
import { LookAtConstraint } from "./LookAtConstraint";
import * as THREE from "three";
import { getWorldPosition } from "../engine/engine_three_utils";
import { RaycastOptions } from "../engine/engine_physics";
import { serializeable } from "../engine/engine_serialization_decorator";
export class OrbitControls extends Behaviour {
...
you can have a look at all our implementations as a reference by clicking on the blue link here (just note that changes to that code will not be persistent - but it might help in learning )
I little bit confused I worked with three.js to make the game I want to try to make the same thing here
for example, I used camera.position Iâm my three.js but here I get the camera but donât return position value
Ah you are accessing the camera component - thats not the threejs camera object. You can either use âthis.context.mainCameraâ or âthis.context.mainCameraComponent.gameObjectâ