Raised This Month: $ Target: $400
 0% 

Collision of two line


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-25-2012 , 10:35   Re: Collision of two line
Reply With Quote #6

The blue box is your plane. You can create the plane variable by using 3 points of that box.

Code:
new Float:plane[4]; xs_plane_3p(plane, box_point1, box_point2, box_point3);

Then you need the start position of the line and the direction it goes.
If all you have is 2 points, then you need to calculate the direction.

Code:
new Float:line_direction[3]; xs_vec_sub(line_point2, line_point1, line_direction);

Finally, apply variables to check if the line intersects the plane.
Code:
new Float:intersection[3]; if( xs_plane_rayintersect(plane, line_point1, line_direction, intersection) ) {     // Line intersects the plane at "intersection" point }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:06.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode