how to move a selected 3d mesh to a other place with one mouse click

Blitz3D Forums/Blitz3D Programming/how to move a selected 3d mesh to a other place with one mouse click

Does this help:

;move selected objects
	If MouseHit(2) 
	
	;get the rightmouse click 3D coordinates
	CameraPick(Camera,MouseX(),MouseY())
	destX=PickedX()
	destY=PickedY()
	destZ=PickedZ()
			
		For unit.soldier 	= Each soldier
			If unit\selected= 1 Then
		
			dx#=(destX-unit\x) 
			dy#=(destY-unit\y) 
			dz#=(destZ-unit\z) 

			;Distance to destination 
			dist#=Sqr(dx*dx+dy*dy+dz*dz) 

			unit\dx#=( dx#/dist# ) * unit\speed#
			unit\dy#=( dy#/dist# ) * unit\speed# 
			unit\dz#=( dz#/dist# ) * unit\speed# 

			;move object 
			unit\x=unit\x+dx 
			unit\y=unit\y+dy 
			unit\z=unit\z+dz 

			EndIf
		Next
	EndIf


UpdateWorld

	For unit.soldier = Each soldier
		PositionEntity unit\entity,unit\x,unit\y,unit\z 
	Next

RenderWorld