Mouse position -> 3D position
Blitz3D Forums/Blitz3D Programming/Mouse position -> 3D position
| ||
Of course, you would have to give one axis, and the other two would be determined from the mouse position What is the best way to do this? |
| ||
Do it how you want it. First possibility: X#=MouseX() Y#=MouseY() Z#=ZValue# moveEntity mesh1, X#,Y#,Z# If you want to place something somewhere (like in an building tool) I would say, let the user click with his mouse on a surface, you want to get the coordinates of that surfacepoint, try following: Camerapick cam,MouseX(),MouseY() moveEntity mesh1, PickedX(),PickedY(),PickedZ() |
| ||
I usually use an invisible plane with EntityPickMode 2Global pln = CreatePlane() EntityPickMode pln,2 EntityAlpha pln,0 ;----------------------------- ent = CameraPick camera,MouseX(),MouseY() If ent = pln PositionEntity 3dcursor,PickedX(),PickedY(),PickedZ() End If Rotate the plane however you like depending on whether you want the cursor to be flat, or going 3D into the scene, or whatever. I also use this concept to move 3D objects around in an editor. When you click an object, position the plane at the object's X,Y,Z and then use it to move the object. |
| ||
There is a sample in the code arcs... |