MINI SUPPORTERS:

 

 

 

 

 
Isometric
Hit Testing
        by Danko Kozar : 3 December 2004

Back to 3d
You can easily imagine this 2d view being converted into 3d isometric view - with only difference that y axis becomes z axis with adding a new y axis. hitTest2 function then becomes:

// --- hit test function --------------------------------
function hitTest2(obj1, obj2) {
if ((Math.abs((obj1.x+obj1.a/2)-(obj2.x+obj2.a/2))<(obj1.a+obj2.a)/2) and (Math.abs((obj1.y+obj1.b/2)-(obj2.y+obj2.b/2))<(obj1.b+obj2.b)/2) and (Math.abs((obj1.z+obj1.c/2)-(obj2.z+obj2.c/2))<(obj1.c+obj2.c)/2)) {
return (true);
}

Using grey buttons, try to hit a purple box with the blue one (box sizes are 50x36x50):

[ rectangular hit testing in 3d ]

Download ZIP

Never mind if objects are displayed with wrong depth - that's because depth sorting cannot be done at this stage (the objects are still overlapping).

Cheers!

Danko
DKOZAR.COM

 


page 3 of 3

 

 

SUPPORTERS:

cloud storage
cloud storage
kirupa.com's fast and reliable hosting provided by Media Temple. Creative web apps. Make your own free flash banners and photo slideshows.
HTML5 CSS3 Mobile Gallery for iPhone, iPad Flash effects. Art without coding.
Flipping Book - page flip flash component. Flash-Gallery.com - Get your flash photo gallery (flash component or swf gallery
X-Platform Application Development for Flash Free Flash Components Download - XML Templates, Players and Galleries.

two computer monitors

US Direct

Learn how to advertise on kirupa.com  
 
SHARE:



MINI SUPPORTERS: