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 / object screen x & object screen y not working as expected

Author
Message
Lasalle
18
Years of Service
User Offline
Joined: 17th Dec 2007
Location:
Posted: 29th Mar 2010 08:38
Trying to get names and health bars above my units in 3d space, have tried the following code, but the result lands the label in the upper left corner, any clue what would cause this code to fail?

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Mar 2010 20:54
Have you tried printing out the values of the variables? Then you might be able to see what's gone wrong. I'd suggest you look at the variables char_state#, object screen x(char_state# ) and object screen y(char_state# ).

Don't forget that the object screen x (and y) functions expect an integer argument so your float char_state# will be rounded down to the nearest integer.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Mar 2010 21:32
It all looks like it's working fine on my system.

Here's an oddly coloured example where each object is labelled:


luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 29th Mar 2010 23:29
My question: Is "char_state#" representing the number of the object you want to have label?
As allways IanM writes us, perfect sample
In the end i may start making collection with sample codes that solves comonly asked questions.

Where there is a will, there is a way.
I often edit my posts, that`s who i am
Lasalle
18
Years of Service
User Offline
Joined: 17th Dec 2007
Location:
Posted: 30th Mar 2010 07:04
WOW holy crap.. great example, thank you very much..
I finally realized in my code that I was not setting the current camera, I have 2 cameras in the scene... that was the root of my problem.

once I added

it seemed to work as expected.

luskos: since I'm using multiple animated models to represent run, idle, attack Im using char_state# to toggle between objects.

Login to post a reply

Server time is: 2026-07-26 21:11:57
Your offset time is: 2026-07-26 21:11:57