Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] Line Segment Intersect Plane Function

Author
Message
Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 11th Nov 2010 19:51 Edited at: 11th Nov 2010 19:54
LineSegmentIntersectPlane(param_Vector3SP0,param_Vector3SP1,param_Vector3PlanePoint,param_Vector3PlaneNormal,param_Vector3IntersectResult)

This function tests against an infinite plane and a line.
Using DPro's 3DMath, Vector3SP0 and Vector3SP1 are endpoints of a 3d line. The Vector3PlanePoint is the point in 3d space where the infinite plane resides. Vector3PlaneNormal is the front facing of the infinite plane. If successful, the Vector3IntersectResult Vector will be filled with the intersection point of where the line crossed the infinite plane at.

When running the example code below, move the mouse pointer over the red box object. PICK OBJECT will detect the mouse pointing at it and then if the LineSegmentIntersectPlane function succeeds, a yellow sphere will appear at the point where the mouse pointer to the distance of the line intersects the infinite plane at. The 3D line is determined from the PICK SCREEN command.

The function will return a 1 if successful.





ExoDev.Com - A Game Development Community Website! Featuring: XBOX360 CONTROLLER LIBRARY
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 13th Nov 2010 17:17
Always useful!

Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 8th Dec 2010 10:24
Thanks Morcilla!

ExoDev.Com - A Game Development Community Website! Featuring: XBOX360 CONTROLLER LIBRARY

Login to post a reply

Server time is: 2024-11-21 15:45:28
Your offset time is: 2024-11-21 15:45:28