Posted: 9th Mar 2004 15:54
I put the attached code together for the following thread: http://darkbasicpro.thegamecreators.com/?m=forum_view&t=27455&b=7

Basically when the mouse button is clicked it positions a red cube object on a 2d X/Z plain at the 3d worldspace position equivalent to the mouse cursor. It would be useful for such things as a isometric tile game.

Oh, and to pre-empt a couple of the usual questions, yes this is DBPro code. Also, I've tested it and it works perfectly. If you have a problem running it, the problem is local to your machine I'm afraid.

Philip
Posted: 9th Mar 2004 17:26
PS: My super secret evil master plan is basically to be responsible for posting the majority of all code snippets using the 3d maths commands. Bwahahahahaha!
Posted: 9th Mar 2004 18:18
is it supposed to work when you change the camera angle/position? because it doesn't for me, unless i'm doing something wrong, all i'm changing is the "position camera" line at the beginning.
Posted: 9th Mar 2004 18:57
Er... no offence Red Eye but that remark betrays a really elementary lack of understanding about how my code works! In fact, GuruYS has just basically asked the same question in the original thread. See the original thread (link above) for my explanation as to why changing the camera's viewing angle causes the code to fail.

If you want to be able to move the camera without playing merry harry with the viewing angle, see the attached code instead.

I think I'll cover all this in exhaustive detail in my forthcoming series for beginners on vector maths and DBPro's 3d vector maths commands.

Philip