How to avoid the transformControl object change when move the transformControl object

Dear all,

Here is my demo, for the transform control, if i drag the object A, and the arrow stopped on object B, the transform controller will move to object B. How to avoid this situation.


I’m not sure I understand the logic of your event listeners. But doing this:

container.addEventListener( 'mouseup', function ( e ) {
	if (transformControl.object) {
		focusedTransformObj = transformControl.object;
	if (currentModule == 0 && ! controlsMoved) {
		onDocumentMouseDown( e );
}, false );

somewhat explains the problematic behavior since you trigger the mousedown logic in the mouseup event listener when certain conditions are true. Like I said before, I don’t understand why you are doing this but commenting out the usage of onDocumentMouseDown() and call it in the mouseDown() event listener seems to stop the above behavior.

1 Like

It might be a reason. There is a function checkIntersection, maybe I am calling this function in wrong position. Let me double check. thanks

I have also encountered this problem, my solution is to add in the dragging- Changed event in transformControls:

Intersects = raycaster. IntersectObjects (selectedMesh, true);

SelectedMesh is the current selected object, that is to say, when dragging the transformControls to release the mouse, no other object is selected, so that you can avoid your problem. If other people have this problem, I hope this answer will be helpful, or you can reply to me if you don’t understand anything, I am happy to help others

1 Like