Quantcast
Channel: Questions in topic: "segment"
Viewing all articles
Browse latest Browse all 14

Segment, plane intersection

$
0
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.

Viewing all articles
Browse latest Browse all 14

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>