Hello Needle,
I’m asking for help because It’s been a few days now since I’ve managed to get one of my scripts off the ground.
I’m currently creating a custom TransformControls, as I only need three rotation axes and one translation axis.
I need to be able to specifically choose the appearance of these axes.
And it also allows me to manage limitations, such as restricting certain movements and so on.
I’ve implemented almost everything (the arrows, the materials, the click and drag systems, etc).
However, I have a huge problem:
I can’t manage to make the local transformations of my object consistent with the movement of my mouse.
Whether it’s rotation or translation according to z, sometimes when I move my mouse in the direction of the arrow it goes in the other direction, sometimes not.
And my camera doesn’t move, only my object and its parents.
I tried to take my inspiration directly from TransformControl from three js but the class alone is 1600 lines long ^^'.
So I hope to find some help here. If you have a solution to guarantee this tracking that would be really great.
I’ve attached my transform creation functions, a photo and the use I make of them in my controlled object.
const customControl = createCustomTransformControl(this.gameObject, this.context.scene, isNew);
update() {
if(this.gizmoSelected && this.gizmoSelected.name) {
const position = this.context.input.getPointerPosition(0)
if(position) {
// this.nodeComponent.mainMouthModel its parents
// this.bevellingEnable used for move its geometry, not the object
const value = applyGizmoTransform(this.gameObject, this.gizmoSelected.name, this.clientX - position.x, this.clientY - position.y, this.context.mainCamera, this.zValue, this.bevellingEnable, this.nodeComponent.mainMouthModel)
this.clientX = position.x
this.clientY = position.y
}
}
}
by user 224464722878005248