Drag the box and it keeps flapping. What’s the reason?
Hi,
May be you should look at your script a little bit closer
I believe it does exactly what you are requesting. You are using the ‘scene.onPointerMove’ to trigger the position of the box. So, basically, each time you move (with a default parameter and without a delta) your box moves as well. And therefor, flickers
What is it just exactly you’d like to achieve? Do you want your box to be attached to the pointer?! Or do you want to pick it first (with I.E. a pointerDown) and next drag-it (until you release the pointer or something)?
EDIT: Or may be this? Remember the pointer is in just a 2D space … unless you pick with ray or something.
Hello, what I want to do is a point function, the object moves with the mouse, the left click of the mouse, I modify according to your second method, first mouse on the model, then enlarge the scene, in the drag model, you will see the model constantly flashing
I’m sorry, I don’t have the time to fix your PG right now (time for lunch )
But I think I (sort of) understand what you want and also… why is not working. Again, it’s about the 2D vs 3D space. If you rotate the camera in the depth and enlarge the scene, there’s no way the pointer can automagically determine that you are moving on z (and not on y). By any means, according to your explanation from your reply and the latest PG, this is not gonna work this way. I’d rather think what you want is something like this:
coming from this part of the doc:
https://doc.babylonjs.com/features/featuresDeepDive/scene/interactWithScenes
I also think this interaction is good, but my business scenario requires a direct move model to do the dot operation
I’m sorry, it must be a language issue and then, english is also not my language
It’s for (quote):
I’m not sure I understand this part correctly. If you mean a 1-step operation (click on the mesh and then clone/drag instantly until click again to release?… is it?) that would be something like this:
Sidenote: I believe in this case (simplified) you would still need to handle the ‘click outside mesh’ to handle the click boolean properly. Apparently if you do things very quickly with this simplified version, the click for pointerUp might not be handled correctly each time. But I would eventually ask you to first confirm that this is (or isn’t) the behavior you want?
EDIT: Forget the above (sidenote). It’s just me being stupid The handle click variable should be set from the mesh pick. This way it works even if clicking outside the mesh (and will also not conflict with other pointerDown events. Here below for the updated PG (however, still not sure if this is really what you want?)
Thank you very much. I know why
Glad to read you found your way around it Honestly, I have to say I still don’t really understand the requirement (but it’s pretty hard without the context). May be you wanna post your solution for the others? That would be great . Next you can also tick your latest post and PG as the ‘solution’. It will prevent from leaving the thread open and will save time for others trying to solve it . Thanks and have a great day