Ship docking help

Blitz3D Forums/Blitz3D Programming/Ship docking help

I'm trying to make a ship dock by clicking dock and then clicking the dock you want to dock to. How do I do this?
Type shipdockerdock
	Field mesh
	Field dockedTo
End Type

Type shipdockership
	Field mesh
	Field dockedTo
	Field side
End Type

starttime = MilliSecs()

While Not KeyHit(1)

;Update Water frame stuff

If FindDocker = 3 Then
	If CameraPick(camera,MouseX(),MouseY()) > 0 And MouseHit(1) Then
		For thisTie.shipdockership = Each shipdockership
			If thisTie\side = 1 Then
				thisTie\dockedTo = PickedEntity()
			EndIf
		Next
	EndIf
EndIf

UpdateWater()
UpdateWorld
RenderWorld

For thisTie.shipdockership = Each shipdockership
	If thisTie\dockedTo > 0 Then
		Line3d(camera,EntityX(thisTie\mesh),EntityY(thisTie\mesh),EntityZ(thisTie\mesh),EntityX(thisTie\dockedTo),EntityY(thisTie\dockedTo),EntityZ(thisTie\dockedTo))
	EndIf
Next

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;Code For Ship Docker Window;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

If Windows(1,3) = 1 Then
	DrawImage Windows(1,0),Windows(1,1),Windows(1,2)
	If MouseX() => Windows(0,1) And MouseY() => Windows(0,2) Then
		If MouseX() =< Windows(0,1) + 20 And MouseY() =< Windows(0,2) + ImageWidth(Windows(0,0)) Then
			If MouseDown(1) Then
				Windows(1,1) = MouseX()
				Windows(1,2) = MouseY()
			EndIf
		EndIf
	EndIf
	If MouseX() => Windows(0,1) + 16 And MouseY() => Windows(0,2) + 56 Then
		If MouseX() =< Windows(0,1) + 48 And MouseY() =< Windows(0,2) + 107 Then
			If MouseDown(1) Then
				;Select Front Hookup
				FindDocker = 1
			EndIf
		EndIf
	EndIf
EndIf


I didn't investigate your source, but I would do it this way: Position a pivot at the ships docking gate/whatever and parent the ship to it. Position an other pivot at the docking station (counterpart) the position the ships pivot at the coords of the stations pivot (the one you wish). You can also move the ships pivot to the station pivot smoothly until it reaches the coordinate. In the same time you may rotate the ship until it fits the rotation of the station.