Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

ofCamera - Mouse picking - how does it work?

$
0
0

@saki7 wrote:

I have a code which draws a multiple 2d rectangle inside cam.begin() and cam.end(). (I assume this adds the z axis, which actually translates the dimension to 3d.)

(Question 1)
Now, I want to check whether a mouse cursor is currently hovering a specific rectangle. I assume cam.screenToWorld(mousePos) does the trick but I can't figure out the actual code.

(Question 2)
I also don't know how to get the mousePos.z value of the mouse cursor (because mouse coordinates are 2d.)

(Question 3)
Same applies to the rectangle. How to get the normalized z value of an actually 2d-drawn rectangle?

Could someone help me on this? Thanks.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles