Hi, I’m relatively new to 3D in JS, and very new to Babylon. I understand the concepts with 2D vs 3D and mouse events not having depth, but I would like to figure out how it would be possible to manipulate SPS particles around the cursor with only a move observer.
At a minimum, without getting into how I’d like to animate the particles after figuring out the position, I’d like to determine the following:
- Is it possible to get x/y coordinates on a particle to match the cursor position when hovered over it, when the z is obviously 0 for the cursor, but is going to be greater when it’s a particle in order to provide depth?
- If so, how do I determine the cursor position in the 3D space? I’ve currently tried a few methods, including ray (albeit, I didn’t know much of what I was doing), as well as examples from a couple of forum posts - but these revolved around having a distance between a click and a drag, in order to calculate 3D position - these examples are in the PG below.
Here is what I have so far and recreated it within a PG and added some comments around where these questions are mostly isolated (pointer move for determining position in lines 44-79, and future particle position changes in 260-270)
Any help would be greatly appreciated as I am a few pages of purple links deep, but it’s possible I’m not knowledgeable enough yet to even know how to properly search