Map Coord picking in 3d

Started by
12 comments, last by ktuluorion 21 years, 5 months ago
quote:Original post by ktuluorion
Original post by Doolwind
Original post by ktuluorion
Basically what i need to do is find a way to figure out what block the mouse cursor is on top of.



Sorry I didn''t read the post exactly . I was thinking you would be doing this whenever you clicked the button.

Anyway, just try it out the simplest way and you can always optimize later (with the binary search). I would not be suprised however if it runs just fine checking every cell every frame.

Doolwind


The only thing is that function doesn''t exist. There is one called D3DXIntersect, but it works on Meshes, and that won''t work.

OK, the function DOES exist, just its in DX 8.1. I''m running 8.0. on this machine. Time to upgrade

[Piebert Entertainment] [Ask The All-Knowing Oracle A Question]------------------------------------------------------------GDSFUBY GameDev Society For UnBanning YodaTheCodaIf you want to see yoda unbanned then put this in your sig ------------------------------------------------------------DAIAGA Dave Astle is a God Association. To join, put this in your sig!Founder and High Priest of DAIAGA[edited by - YodaTheCoda on December 10, 2003 1:57:54 PM]
Advertisement
Yeah sorry I didn''t specify that I was using 8.1. Tell me how it goes, I am currently checking every cell and so far I have tested with 250x250 cells and everything runs perfectly.

Doolwind
quote:Original post by Doolwind
Yeah sorry I didn''t specify that I was using 8.1. Tell me how it goes, I am currently checking every cell and so far I have tested with 250x250 cells and everything runs perfectly.

Doolwind


Great! Thanks for all your help! I''m going to try to get it in tonight and see how it works. The only thing I am unsure of is how I should set the position and direction variables for the call. I need to figure out some way to convert the coords on the screen to something in the 3d space. Shouldn''t be that big of a deal though.

-Mike
[Piebert Entertainment] [Ask The All-Knowing Oracle A Question]------------------------------------------------------------GDSFUBY GameDev Society For UnBanning YodaTheCodaIf you want to see yoda unbanned then put this in your sig ------------------------------------------------------------DAIAGA Dave Astle is a God Association. To join, put this in your sig!Founder and High Priest of DAIAGA[edited by - YodaTheCoda on December 10, 2003 1:57:54 PM]
ktuluorion-

I just stole that code straight from the SDK "picking" example. I literally cut the code and pasted it and only changed the bits to the actual D3DXIntersectTri call, where I looped through all the cells passing in the coordinates of each cell.

If you have any troubles, when I get home from work I can put up the code I used for mine if that would help at all.

Doolwind

This topic is closed to new replies.

Advertisement