java - LibGDX - Overlapping 2 bounding boxes -


i have 3d scene going place 2 objects - sun & planet. when sun overlapped planet has hidden. so, need detect event using methods of libgdx. i've tried find intersection using intersector class below:

//create ray pointed on center of sun ray ray = new ray(camera.position, sun.position);  boundingbox bboxplanet = new boundingbox(); planet.transform.idt(); planet.transform.translate(-2, 0, -8); planet.transform.scl(0.025f); planet.calculateboundingbox(bboxplanet);  boolean retval = intersector.intersectrayboundsfast(ray, bboxplanet); 

enter image description here

the ray points on sun center , when planet overlaps ray retval should true, doesn't. don't know why. doing wrong? perhaps, not best decision. if so, how can solve issue in best way. thank in advance.


Comments