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 / 2D box in 3D Space

Author
Message
spike 132000
18
Years of Service
User Offline
Joined: 7th Nov 2007
Location: Nottingham, UK
Posted: 27th Sep 2011 00:54
How do I make a box and place it on the screen in my 3D world?

using box 10,10,speed,40,red,red,red,red

doesn't work...

http://feedit.me - Live feed platform, useful for events and shows!
Mr Bigglesworth
18
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 27th Sep 2011 01:38
It would be better to use 2D sprites or 3D planes. They are much faster and would suit a 3D world better.
spike 132000
18
Years of Service
User Offline
Joined: 7th Nov 2007
Location: Nottingham, UK
Posted: 27th Sep 2011 01:40
ok, but I don't want it to move from position 10,10 on my x,y axis. If i create a plane, wouldn't I have to keep repositioning it?

http://feedit.me - Live feed platform, useful for events and shows!
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 27th Sep 2011 02:03 Edited at: 27th Sep 2011 02:05
I believe you can lock an object to the camera. Apart from that, pasting an image is the other alternative. Otherwise I haven't checked whether other 2D plugins draw 'after' everything has been rendered which would be better.

Warning! May contain Nuts!
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 27th Sep 2011 02:30 Edited at: 27th Sep 2011 02:35
I don't delve in 3d that much... so correct me if I am wrong. But I thought that using perhaps a combination of DRAW TO FRONT & DRAW TO CAMERA(may not be necessary) would force all 2d to be done after 3d? Not sure if the box command is included in that description of the help like text, images, sprites etc... are. Some of the help just says 2d artwork???

I actually thought that DRAW TO FRONT would be all that was needed alone. Can't really decide what effect DRAW TO CAMERA/DRAW TO SCREEN would have... but I can't test right now.

Your signature has been erased by a mod please reduce it to 600 x 120.
Webber
15
Years of Service
User Offline
Joined: 27th May 2011
Location:
Posted: 27th Sep 2011 03:46
It depends on what your trying to do.
It looks like you want some graphic on the screen for telling you players speed.

I agree that using a sprite would be more efficient, but I don't see why box 10,10,speed,40,red,red,red,red wouldn't work.

The error might just be the placement of the box command.
Did you put it inside your main loop?
If you didn't then it will not show up.
Did you make red = rgb(255,0,0)?
If not then your box might just be invisible.
It turns out that you can make cool transparent effects if you mix black with other colors.
I didn't even know that, I just figured that out.
Just so you know, you can select from about 16777216 different colors by clicking on the right mouse button, and then clicking on Insert RGB Colour.


Anyways, this is what I came up with.



If you are going to use sprites instead, you will need to scale, and position the sprite based on the variable speed, it will be much more difficult. And making a transparency effect will also be more difficult. Using a sprite will run much faster, but since it doesn't look like you need 100 boxes, I don't think that using boxes will slow things down very much.
Also if you don't want a gradient or transparency effect on your box.
Then you can use the ink command instead for selecting a color for your box. I'm not sure, but I think that it might run faster too.



And using a plain would not have to be repositioned more then a sprite would. Just on the x axis, however you would need to use disable object zdepth, and use lock object on in order for it to be fixed to the screen, and not be effected by the 3D environment. And since it is a 3D object, it would be much more difficult to get the object to be the right size and position on the screen.

You could also do it by repositioning it and rotating it to follow the camera, but you would still have to diable the objects z depth, or the plain will be effected by the 3D environment.

Hope that helps.




And if you think that I over complicated it, because I did, here is a simplified version of the program.






I like games, and stuff.

Login to post a reply

Server time is: 2026-07-11 14:37:06
Your offset time is: 2026-07-11 14:37:06