Code taken from another thread has proved useful however as it's in 3D and i want the posititon not to change in height for the moment it doesn't quite work as intended.
I'd though i'd try one of vitek's methods but as it involves the use of getIntersectionLine i can't. Has anyone managed to implement something similar to a point and click system of movement?
Code: Select all
Line3D line = device.SceneManager.SceneCollisionManager.GetRayFromScreenCoordinates(Mouse, null);
Vector3D camPos = device.SceneManager.ActiveCamera.Position;
Vector3D nodePos = selectedSceneNode.Position;
Vector3D nodeDist = nodePos - camPos;
Vector3D destPos = line.GetVector();
destPos.Normalize();
destPos = new Vector3D(destPos.X * (float)nodeDist.Length, destPos.Y * (float)nodeDist.Length, destPos.Z * (float)nodeDist.Length);
selectedSceneNode.Position = destPos + camPos;