move 3d object w mouse

Blitz3D Forums/Blitz3D Programming/move 3d object w mouse

If you want to move an object along the ground, create a plane, and make it pickable, then use camerapick to pick the point under the mouse, The resulting pick location is the point where the ray from the mouse intersects the plane in the world, and that is where you should place yout object if the mouse has clicked on the object and the mouse is being held down.

If however you don't want to just move objects around on the "floor" but instead want to move them around other planes you'll have to build a quad mesh for that.

Alternatively, do this:

Dx#, Dy#, Dz# is the distance you desire to move the object on each axis of the camera. ie, Dy# = 1 means move the object one unit "up" realtive to the camera's face direction.

TFormVector Dx#, Dy#, Dz#, Camera, 0
Dx# = TFromedX()
Dy# = TFromedY()
Dz# = TFromedZ()

Dx#, Dy#, and Dz# are are now in global space, and if you move your object like so, it will move in the desired direction the desired amount.

TranslateEntity Entity, Dx#, Dy#, Dz#, 0