Simple look at target?

// NEEDLE_CODEGEN_START
// auto generated code - do not edit directly
using UnityEngine;
using UnityEngine.Animations;
#pragma warning disable

namespace Needle.Typescript.GeneratedComponents
{
public partial class LookAt : UnityEngine.MonoBehaviour
{
public LookAtConstraint @target;
public void update(){}

}

}

// NEEDLE_CODEGEN_END

by user 855361388318425109

this is what i was trying to do

by user 855361388318425109

for example:

import { Behaviour, serializeable } from "@needle-tools/engine";
import { Object3D } from "three"

export class LookAt extends Behaviour {

    @serializeable(Object3D)
    otherObject?: Object3D;

    update() {
        if (this.otherObject)
            this.gameObject.lookAt(this.otherObject.position)
    }
}

ok what should i name the file ?

by user 855361388318425109

You need to add @serializable() to all object references with the type you’re trying to assign needle-engine-support/documentation/scripting.md at main · needle-tools/needle-engine-support · GitHub

Doesnt matter :slightly_smiling_face:

You can even have multiple scripts in one typescript file

cs ?

by user 855361388318425109

c#

by user 855361388318425109

You put it in a file like LookAt.ts

in src/scripts for example

you can read about more that in Needle Engine Scripting | Needle Engine Documentation :slightly_smiling_face:

And you can download a project from Samples Projects | Needle Engine Documentation if you need more examples

na that’s not working

by user 855361388318425109

What exactly?

Screenshot_2022-10-18_at_12.05.44.png

by user 855361388318425109

by user 855361388318425109

the file is not showing

by user 855361388318425109

yet it’s inside

by user 855361388318425109

you mean the c# code? Its generated in Assets/Needle/Components.codegen if you put it in thesrc/scripts folder