我找了下, 这是6.3的SDK里给的<TV3D - Mouse picking + cursor>里面有如下这一段
显然, 他用了Pick.GetImpactPoint以后用计算了一下用方向,得到Direction,再用Direction进行移动,不过这里貌似还是不能获得鼠标点击的位置.
'Terrain Picking
If b1 <> 0 Then
Set Pick = Scene.MousePicking(Mx, My, TV_COLLIDE_LANDSCAPE, TV_TESTTYPE_ACCURATETESTING)
If Pick.IsCollision = True Then
'You can get the picked point with the ImpactPoint method
Destination = Pick.GetImpactPoint
Direction = VNormalize(VSubtract(Destination, Vector(PosX, PosY, PosZ)))
'Obtain the angle with trigo maths
angle = Direction2Ang(Direction.x, Direction.z)
'If Direction.x > 0 Then
' angle = Rad2Deg(Atn(Direction.z / Direction.x))
'Else
' angle = Rad2Deg(Atn(Direction.z / Direction.x)) + 180
'End If
Actor.SetRotation 0, 90 + angle, 0
Walk = True
Actor.SetAnimationName "walk"
End If
End If
'Makes the scientist walking
If Walk = True Then
Dim p As D3DVECTOR
p = VAdd(Vector(PosX, PosY, PosZ), VScale(Direction, TV.TimeElapsed * 0.05))
PosX = p.x
PosZ = p.z
If Int(PosX * 2) = Int(Destination.x * 2) And Int(PosZ * 2) = Int(Destination.z * 2) Then
'If he's reached his destination, stop it !
Walk = False
Actor.SetAnimationName "idle"
End If
End If