We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › mouseOver in 3D sketch
Page Index Toggle Pages: 1
mouseOver in 3D sketch (Read 819 times)
mouseOver in 3D sketch
Nov 20th, 2009, 2:43am
 
Hello, I'm having some issues with my 3D scene. I have some ellipses and a mouse over function of this type:
Code:

if(mouseX<=(aziende[i].x+(aziende[i].diameter)/2) && mouseX>=(aziende[i].x-(aziende[i].diameter)/2) && mouseY>=(aziende[i].y-(aziende[i].diameter)/2) && mouseY<=(aziende[i].y+(aziende[i].diameter)/2)){
aziende[i].name();
aziende[i].over=true;

Azienda azienda = getAziendaByName(records[i].name);
if(azienda!=null) {
linea[i].over = true;
}
}


Probabily the issue is that in 3D (i'm using only a zoom in and a pan camera) I need to use the projections of the ellipses on the screen for the mouseOver.  But i don't know how to do that. Any help?

Thanks

Lorenzo
Re: mouseOver in 3D sketch
Reply #1 - Nov 20th, 2009, 5:11am
 
You'll need to register mouseOver on the projections as you suggested, since the x,y coordinates don't correspond to your ellipses' positions on screen.  I've never done this but it's certainly been discussed here before.  IIRC you can create a 'mask' from your 3D object in a separate PImage; check the colour value of the pixel under the mouse location in this PImage and if it meets a threshold value you have mouseOver...

Obviously easier said than done Wink
Re: mouseOver in 3D sketch
Reply #2 - Nov 20th, 2009, 6:32am
 
Ok! i understand the idea, but i've no idea how to make that. Plus here i'm talking of 400 separate objects, how would i refer to one an not to another ellipse just using color?

tricky.
Lorenzo
Re: mouseOver in 3D sketch
Reply #3 - Nov 20th, 2009, 7:22am
 
here are the hacks mentioned : http://processing.org/hacks/hacks:picking

btw please delete your other postings
Page Index Toggle Pages: 1