Page 1 of 1

Plane3d and getIntersectionLine

Posted: Thu Nov 22, 2007 4:31 pm
by cdrwolfe
It seems that getIntersectionLine is missing form the .NET irrlicht engine, i've been trying to implement a simple RTS mouse click movement system.

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;
Regards Wolfe