I’m importing an object file, let’s say it’s a plane for example. I want to be able to draw on the plane and I just can’t seem to figure out how it’s done. It’s fairly trivial to know the x and y coordinates of the mouse click but what about the z coordinate? I need to be able to do some sort of ray tracing that shoots out a ray and tells me as soon as it reaches the object. What I’m trying to know is the z coordinate of the click which is on the object. There are no other objects in my space is a good assumption.
Share
Googling a bit gave me these nice advices:
one
two
three
four
Some time ago i used them (almost all of them) to create my application. For some reasons i have not got this application now but i can show you my code getting 3D-vector of pick point in a 2 .. 3 hrs =)
If you do want to implement “drawing on an object” i suggest you need to find the UV (texture) coordinates of the pick point and then perform some drawing operations on the object texture.
UPADTE: my picking function implementation
Here, sf::Vector3f is simply a SFML Vector class.