you know I amm not coder, soo… , yes I know, in browser its still moving in X, Z
by user 869976161550217286
you know I amm not coder, soo… , yes I know, in browser its still moving in X, Z
by user 869976161550217286
Ah sorry i misunderstood you. You want it to only move on Y and I sent you a script that will move X and Z and NOT on Y
import { Behaviour } from "@needle-tools/engine";
export class ConstraintYPosition extends Behaviour {
private _x: number = 0;
private _z: number = 0;
awake(): void {
this._x = this.gameObject.position.x;
this._z = this.gameObject.position.z;
}
onBeforeRender(): void {
this.gameObject.position.x = this._x;
this.gameObject.position.z = this._z;
}
}
^ try this
:), ahhh yes this is with this script, thats why it doesnt move in Y :
by user 869976161550217286
by user 869976161550217286
@marcel great it works! but only when I am close to the ground, then Y axes is activated… its related to cameraa position, same as drag controls… I will solve it by Buttons… anyway thank you for you support
by user 869976161550217286
Yeah DragControls behaves like that right now. We want to make the configureable in a coming version!
Buttons should get you there (you can also make it so that you click on the roof if you want that - just put the unity Button component on the Roof object)
I have still limit Y position dont go under its min position, only up and then go back in its initial state
by user 869976161550217286
yes someting like your hotsposts example?
by user 869976161550217286
like your hotspost example
by user 869976161550217286
but I need to learn how to animaate it
by user 869976161550217286
you know I am new to to JS scripting and now I have to typescript
by user 869976161550217286
ohhh thats challenge, nevermind
by user 869976161550217286
You can do the animation + the button stuff without writing any extra code. Like you would in Unity with the Animator + AnimatorController + a Button component to call “setTrigger” on the animator to make a transition to another animation state where the roof is up in the air
OK, and this will works after build with needle
by user 869976161550217286
Yup
So its native unity workflow
by user 869976161550217286
ok
by user 869976161550217286
Yes that works. Timeline as well