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.

DarkBASIC Professional Discussion / Mouse Info and 'Creation'

Author
Message
Disrupter52
15
Years of Service
User Offline
Joined: 9th May 2011
Location:
Posted: 4th Sep 2011 06:43
Ok so i have yet another question for all those willing.

The easiest way to say this is: I want to be able to build things in my game. Like as part of the game-play.

I want to be able to knock holes in walls or repair them. The best way ive thought of is to look at an wall object, maybe click in a small menu (not at this point really), have a sem-transparent ghost object appear (like when you're building a base in any RTS game, green for good, red for nope), and then do a difference with that ghost object and the wall to make a whole.

Is there any way to get where the camera is actually pointing, compare it with whats on screen and with objects that i want being differenced so kind of isolate one? So then if i have multiple objects on the screen, i can select any of them, but only one at a time?

I feel like if i can pick out an object with the mouse or controls, then i can get its coordinates and make a ghost object based off of them and then maybe position it on the x/y/z and then let the difference happen so it makes the whole.

Also, is it possible or does DB pro in any way keep track of like an object's xyz as opposed to the worlds? Like a way to get Object A's xyz and then Object B's same xyz (both would obv be the same object just instanced) rather then try to find that same point based on world coordinates?

just to be clear, say i have 2 cubes placed at random, but i want their 0,0,0 (or any coordinate within the object's bounds) to interact. Is there a way to just have those coordinates interact without having to find them in the world or at least without having to locate them based exclusively on the world?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 4th Sep 2011 14:03
The mouse selector answer is just 3 posts under your own post...

http://forum.thegamecreators.com/?m=forum_view&t=188980&b=1

And the second question sounds like you just need a distance formula, but I can't really understand the question.

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 4th Sep 2011 15:30 Edited at: 4th Sep 2011 18:15
2d distance = sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) )

3d distance = sqrt( (x2-y1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) )

I hope that's correct and without typos...

EDIT:

2d angle = atanfull( y2-y1, x2-x1 )

Different people use cos and sin in different ways, but if you're using cos x and sin y then the above use is correct. There has been discussion about the order of the atanfull() function but for my use recently the above worked...

Warning! May contain Nuts!
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 4th Sep 2011 17:41 Edited at: 4th Sep 2011 17:45


This might not be totally what your after, but could be useful.

"Son, I crap bigger then you !"

Login to post a reply

Server time is: 2026-07-10 15:31:36
Your offset time is: 2026-07-10 15:31:36