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 / How to move my HUD along with the camera

Author
Message
Zwarteziel
15
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: Netherlands
Posted: 15th May 2012 22:40 Edited at: 18th May 2012 00:31
Hi all,

I'm trying to code a HUD using plains. I'm using an example provided in 2004 by forum-member Cloggy. I've almost got it working as I'd like to, except for one thing: when I move my mouse along the X-axis, the panels follow the camera nicely. However, when I move the mouse up and down, the plains drift out of view. I've been trying to figure out how to get it working, but am stuck. Can someone provide a clue?

Here's my code:



The function that probably holds the answer is called HudPosition. I appreciate your thoughts!
zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 15th May 2012 22:46 Edited at: 15th May 2012 22:47


Line 107:
rotate object Obj, CamAngX, wrapvalue(CamAngY+180), CamAngZ ` turn object left Obj, 180

Needs to be:
rotate object Obj, -CamAngX, wrapvalue(CamAngY+180), CamAngZ ` turn object left Obj, 180

It's rotating the obj on the x axis in the wrong direction.


Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.
Zwarteziel
15
Years of Service
User Offline
Joined: 22nd Jan 2011
Location: Netherlands
Posted: 15th May 2012 22:52
Wow that was quick! Thank you very much... you don't want to know how many hours I've been staring at my code, wondering what I was doing wrong
zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 15th May 2012 23:00
No worries. Just glad to help.

Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.

Login to post a reply

Server time is: 2026-07-22 00:34:44
Your offset time is: 2026-07-22 00:34:44