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.

Newcomers DBPro Corner / Placing a 3D Plain on the Screen (Lock Object On)

Author
Message
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 7th Oct 2008 03:21
Sorry if this has been asked before, but I've always been perplexed by this.

How can one know exactly where an object such as a plain will go when it is placed on the screen using LOCK OBJECT ON? I use position object, and I usually get it where I want it via trial and error. Is there a better way? Also, is there a way to get a plain to fit perfectly over the entire screen reguardless of the user's screen resolution?

Thanks for any help,
-Sixty Squares

Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 7th Oct 2008 14:08
Try looking here:

http://forum.thegamecreators.com/?m=forum_view&t=42508&b=6

I hope it helps.


Whatever...
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Oct 2008 22:41
Quote: "Also, is there a way to get a plain to fit perfectly over the entire screen reguardless of the user's screen resolution?"

Yes.

Use cloggy's method, or this code using LOCK OBJECT ON:


Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 8th Oct 2008 00:12 Edited at: 8th Oct 2008 00:12
Thank you both for responding. I can't test them right this moment, but if I have any questions on this I'll report back here. I can now resume my toying around with DBP .

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Oct 2008 01:23
This is an easy method. Don't worry about the details, it just works. Assuming the camera is at 0,0,0 when you place the objects, calculate the Z position:

z# = (screen height() / 2.0) / tan(FOV * 0.5)

FOV is the field of vision. If you haven't changed it (SET CAMERA FOV()), then the default value is 61.9621353149

At this distance, your plains are 1 unit / pixel. So, a 3D plain of size 50x50 is actually 50x50 pixels on screen. 0,0 (X,Y) is the centre of the screen.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 8th Oct 2008 23:05
I thought is was that when lock object was use x,y 0,0 was in the top right hand corner of the lock screen, and you worked it out from there.

Dark Physics makes any hot drink go cold.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 9th Oct 2008 11:01
No, Lock object doesn't change 3D coordinates. Then you would simply call them Sprites, which we already have

Login to post a reply

Server time is: 2024-11-25 16:34:24
Your offset time is: 2024-11-25 16:34:24