curtainsjs icon indicating copy to clipboard operation
curtainsjs copied to clipboard

Multiple Planes issue

Open julienprivat opened this issue 2 years ago • 1 comments

Hello Martin ! thanks a lot for your library, it's awesome... ! I tried to make a simple movement on two planes in connexion to the mouse position... I'm very close, everythings seems to be ok, except, I don't understand why the both planes.uniforms are connected.... When I play my function handleMovement, where I specified the special plane, the second plane take also the new position of the mouse (only if I all ready pass my mousse on). The result they have the same movement on the same moment. What I would like : there are indépendant like in your exemple (https://codepen.io/martinlaxenaire/pen/jeZyZM?editors=1010) I make my code on this pen : https://codepen.io/julienprivat/pen/ExmrXaP?editors=0010

Thank you !

julienprivat avatar Aug 11 '21 13:08 julienprivat

Hi @julienprivat,

I think it is most probably a copy by reference issue. Using this inside your handleMovement function should do the trick:

plane.uniforms.mousePosition.value.copy(plane.mouseToPlaneCoords(mousePosition));

By the way, please try to keep your example pen as minimal and functionnal as possible, it'd help debugging it quicker. :)

Cheers,

martinlaxenaire avatar Sep 01 '21 08:09 martinlaxenaire