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 Discussion / Locking object onto screen

Author
Message
Sonic 91 Software
20
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 3rd Dec 2005 15:16
I am making a driving game and I want the object showing the speed/fuel to be locked onto the screen, but this doesn't work. The object doesn't show up, let alone get locked to the screen! (Object 1 is the car)

I am a Christian and I know that God loves me. That is what makes my life so great!
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 3rd Dec 2005 16:21
Well, when locking to the screen, all position variables become relative to the camera's position.
With other words, your object is positioned at the exact spot of your camera and can't see it due to the minimum camera range.

Try
position object 0,0,20

= center of screen at a distance of 20. (Change the 20 to the wanted value)

Immunity and Annihalation makes Immunihalation...
SimSmall
20
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 3rd Dec 2005 16:38 Edited at: 3rd Dec 2005 16:40
Use Sven B's little snippet (yes it did say cnippet a second ago...), but make sure the last number is never below 1. - try all different values until it looks how you want it to.

otherwise it's so close to the camera DB thinks it would be wasting time drawing it...

...maybe one day I'll finish a project
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th Dec 2005 07:09
When working out the X,Y,Z position of the object to lock onto the camera, imagine X and Y are the screen co-ordinates where the centre of the screen is 0,0.

Negative X values move it to the left and negative Y values move it up the screen.

The Z is the depth into the screen (or behind the camera if negative).

TDK_Man

Login to post a reply

Server time is: 2025-05-22 23:59:55
Your offset time is: 2025-05-22 23:59:55