Getting the mouse worldspace position under the mouse?

UM so I kinda got this thing to work again. My problem goes back to that world space position. I don’t mean selecting a given object, I mean the exact world space position beneath the mouse. So objects can be put there, with precision, and preferably with some preference for the closest object to the camera (ie. in z-order, if we’re ordering them closest first, its the zero-eth element excluding the camera)

If you don’t want to represent the plane as an 3d object, you can use this.

If I recall correctly, there’s an easier means of getting a line-plane intersection in Panda:

See here:

Did you ever get that ray-casting approach working? If so, then what was lacking there? Perhaps we can improve upon it!

If you didn’t, then how far did you get?

My feeling is that ray-casting is likely to be the most straightforward means of doing this, and that it should be pretty precise. After all, it should do exactly what you seem to be describing: find the nearest surface-point under the mouse.

@Thaumaturge In fact, I already used the Plane() class in 2011 to implement gizmo for the editor.

Fair enough, and my apologies then! I do stand by recommending the Plane() class over doing the maths by hand, however!

@Thaumaturge actually no I realized that (months ago) I had used a similar bit of code to do camera terrain grabbing… so I copied that code and got what I wanted only there is no model intersecting detection. In other words, I’ve got my position in world space beneath the mouse but no collision/intersection detected…

@WhereIsTheLove I recommend that you decide what you want in the end. You contradict yourself every post.

Okay, fair enough–in that case I stand by my suggestion of ray-casting. As I said, it should do just what you want, by the sounds of it.