Hmm, this sounds like it should be simple enough, only I’m pretty sure the mouse position is in 2D.
Maybe with a a ray sensor and tracking you could keep the object at a distance from you while still “dragging” it with with the mouse.
Let me grab a coffee and see what I can mash together…
Well I managed to get one to work, but only with the camera with LocX=0. In this way the mouse position in X and Y can be used.
Here’s the code:
width = float(Rasterizer.getWindowWidth())
height = float(Rasterizer.getWindowHeight())
senGrabbed = c.getSensor("grabbed")
senClick = c.getSensor("click")
senMove = c.getSensor("move")
senOver = c.getSensor("over")
actCon = c.getActuator("con")
owner.mousex = (senMove.getXPosition()-width/2)/aspectx
owner.mousey = -(senMove.getYPosition()-height/2)/aspecty
owner.grab = 50
owner.grab = 0
And here is a zipped blend file showing it in use
Left Mouse Button grabs sphere
Hold Left Button and move mouse to move
Release left button to drop.
I’m sure there is a way to xfer 2d coordinates into 3d, this would allow more camera freedom…I can’t figure it out though, so this is the best I can do.
Hope it helps, or can at least get you started.