Skip to main content
9 events
when toggle format what by license comment
Jun 22, 2020 at 5:32 vote accept Lenny White
Jun 21, 2020 at 13:45 answer added wychmaster timeline score: 4
Jun 19, 2020 at 13:47 comment added Lenny White @wychmaster Appreciate it. Unfortunately changing w or dividing by w gives the same result. With my implementation x and y coordinates do get offset in the direction of the cursor but by much larger amount. So x and y maybe need to be divided by something. Dividing by w doesn't do anything though.
Jun 19, 2020 at 11:42 comment added wychmaster Have a look into my answer in this question It is basically the same problem, just that you are looking for a point on the near plane (z=-1) and you use a different projection. As far as I can see, the vector cScreen in your second code snipped needs a w component of 1 and not 0. Don't know if that already fixes the problem. You might also need to divide the result vector cView by w
Jun 19, 2020 at 10:22 comment added Lenny White @wychmaster "So you basically just need to find the position on the near-plane that corresponds to your cursor position" That's what I tried to do in the second code snippet. The results I'm getting is that the calculated cursor position doesn't match the position of the cursor.
Jun 19, 2020 at 10:18 comment added wychmaster I don't really get what exactly you are asking. "How does it work" or "where is the error in my code"? Also, what results do you expect and which ones do you get? In an orthographic projection, all rays are parallel to the cameras' viewing direction. So you basically just need to find the position on the near-plane that corresponds to your cursor position and fire a ray into the cameras view direction.
Jun 19, 2020 at 10:03 history edited Lenny White CC BY-SA 4.0
added 6 characters in body
Jun 19, 2020 at 9:57 history edited Lenny White CC BY-SA 4.0
added 58 characters in body
Jun 19, 2020 at 9:50 history asked Lenny White CC BY-SA 4.0