@Obese and BN2
True in both cases. If one looks at it like I think Obese is, then you have to compute a 3d vector directly into the screen at the mouse position. And if the camera rotates on any axes but y, the math can get very tricky... If one looks at the question like BN2, then you can move the 3d object relative to the camera based on MouseMoveX() and MouseMoveY. If you position the mouse at the 3d objects position after the move (assuming the pivot point of the object is it's center) then it appears as if the object is moving with the mouse. Again, as long as the camera angle is only y rotated there shouldn't be any problems. Here's a quick example of that:
sync on
sync rate 60
autocam off
rem object to move with mouse
make object cube 1,25
position object 1,5000,14,5000
rem matrix for reference
make matrix 1,10000,10000,25,25
position camera 5000,50,4800
do
rem no mouse button move on x and y
if mouseclick()=0
newx=newxvalue(object position x(1),wrapvalue(camera angle y()+90),mousemovex())
newy=newzvalue(object position y(1),wrapvalue(camera angle y()),0-mousemovey())
endif
rem right click to move on the z axis
if mouseclick()=2
newz=(0-mousemovey())*cos(camera angle y())+object position z(1)
position object 1,newx,newy,newz
endif
position object 1,newx,newy,object position z(1)
position mouse object screen x(1),object screen y(1)
sync
loop
If you don't click any mouse buttons, the object moves up and down. If you click the right mouse button, the object will move along z. I used trig for the z part just to show it, but it's just the trig representation of the newzvalue command so you could use either.
Enjoy your day.