Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Position object on 2d X/Z plain at position represented by mouse cursor

Author
Message
Philip
20
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
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

What do you mean, bears aren't supposed to wear hats and a tie? P1.3ghz / 384 megs / GeForce MX 5200 128meg / WinXP home
Philip
20
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 9th Mar 2004 17:26 Edited at: 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!

What do you mean, bears aren't supposed to wear hats and a tie? P1.3ghz / 384 megs / GeForce MX 5200 128meg / WinXP home
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
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.

In the beginning, the universe was created...
This made alot of people very angry and it has been widely regarded as a bad idea...
Visit http://redeye.dbspot.com
Philip
20
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
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

What do you mean, bears aren't supposed to wear hats and a tie? P1.3ghz / 384 megs / GeForce MX 5200 128meg / WinXP home

Login to post a reply

Server time is: 2024-05-12 01:29:40
Your offset time is: 2024-05-12 01:29:40