# Segment, plane intersection

 0 Hi all,I am working on a mesh spawning algorithm to be used for special effects, and need to calculate random segment intersections against a plane.There's lots of info regarding this subject for other platforms, but I could find nothing about Unity and, albeit the problem is certainly trivial for those with a math background, the subject is horribly complicated for those that don't have one.Basically, I can easily understand if a segment, formed by two points P1 and P2 intersects a plane with a simple distance calculation, but finding the exact intersection point on such plane, defined as Unity's planes through a Vector3 normal and an origin Vector3 point, is giving me unexpected results.For example, I'm using the following formula, given d1 and d2 as float distance respectively from P1 and P2 to the plane, ``````Vector3 intersection = (d2*P1 + d1*P2) / (d1 + d2); ``````but the results I get are -never- exactly on the plane, but always slightly in front or behind it.So I am hoping somebody knows a better formula that can give exact results instead of the approximation than the above formula seems to perform.Thanks in advance. more ▼ asked Feb 05 '12 at 08:29 AM roamcel 1.2k ● 37 ● 40 ● 44 add new comment (comments are locked) 10|3000 characters needed characters left ▼ Viewable by all users

Be the first one to answer this question

By Email:

Topics:

x248
x132
x19
x7
x3

asked: Feb 05 '12 at 08:29 AM

Seen: 746 times

Last Updated: Feb 05 '12 at 08:35 AM