Simple look at target?

hi , )

i’m struggling…

Original Post on Discord

by user 855361388318425109

Can you write a bit more about what you want to archieve?

Are you more familiar with Unity or with threejs / typescript?

For one there is this method: three.js docs

For how to make references from Unity to threejs you can learn a lot from this post: Discord

For accessing the camera use this.context.mainCameraComponent from your script :slightly_smiling_face:

to be clear, “in unity” it’s very easy to create an script that look at target

by user 855361388318425109

transform.LookAt(target);

by user 855361388318425109

but i need a unity/needle version

by user 855361388318425109

in threejs its the same: this.gameObject.lookAt(...)

Just note that Z forward is inverted in threejs

-1 is forward

yeah but as a unity/needle component

by user 855361388318425109

theres a helper for that lookAtInverse in engine/engine_three_utils.ts

this is a needle component / typescript :slightly_smiling_face:

ok ok

by user 855361388318425109

so can you copy a full script ?

by user 855361388318425109

this.gameObject is the Object3D / threejs object your script is attached to

sorry?

some like that :

by user 855361388318425109