Quantcast
Channel: Daz Script Developer Discussion - Daz 3D Forums
Viewing all articles
Browse latest Browse all 1036

Trouble with DzBox3.getIntersection

$
0
0

I have created a box and determined the intersection points with a ray. Instead of the expected values, I get [0,0,0] and [1,1,-1]. If I swap the ends of the ray, I get [0,0,0] and [1,1,5].
I would have expected to need only one call and get the values [1,1,-1] and [1,1,5]. Did I misunderstand something or is something not working as it should?

var box = new DzBox3("[[ -3, -2, -1 ],[ 5, 5, 5 ]]"); //[[ minX, minY, minZ ],[ maxX, maxY, maxZ ]]
print("box:", box);
var ray = new DzLine3(new DzVec3(1, 1, 10), new DzVec3(1, 1, -20));
var intersection = box.getIntersection(ray);
print("Intersect:", intersection.intersects, "- first:", intersection.firstIntersection, "- last:", intersection.lastIntersection);

ray.swapEnds();
intersection = box.getIntersection(ray);
print("Intersect:", intersection.intersects, "- first:", intersection.firstIntersection, "- last:", intersection.lastIntersection);

The output is

box: [[-3,-2,-1],[5,5,5]]
Intersect: true - first: [0,0,0] - last: [1,1,-1]
Intersect: true - first: [0,0,0] - last: [1,1,5]


Viewing all articles
Browse latest Browse all 1036

Trending Articles



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