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 / Pointing HUD arrow

Author
Message
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 7th Mar 2009 03:40
hi all i am trying to make an arrow draw on the bottom center of the screen with



but what i need of it is to stay in that position relative to the camera so that when i move about it seems to be glued there, the problem i am having is that when i turn my camera around it doesnt move with it and when i move the camera back it takes some time for the object to catch up....

any help with this would be very appreciated!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 7th Mar 2009 10:52
try lock object on objectnumber, this will lock the object to the screen will have to set the z value to about 20 to start untill you find what look right.

Dark Physics makes any hot drink go cold.
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 7th Mar 2009 12:26
thanks that worked..

i am now tring to get the object to point to another object but it wont work i even tried using the command before i locked the object.

could it be that i need to ulock it every frame so that it can update the point at command...

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 7th Mar 2009 17:49
should only need to lock the object once.

try



where id in the number you are hoping it will point at.

Dark Physics makes any hot drink go cold.
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 7th Mar 2009 23:58
i actually tried pointing it to 0,0,0 and that didnt make it do anything and when i put in the variable that has the objects id it did not do anything either?
Kira Vakaan
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 9th Mar 2009 07:14 Edited at: 9th Mar 2009 07:17
I never liked using the lock object on command because it really just keeps the object at the origin of the world and displays it on the screen anyway, and as you pointed out, any pointing or positioning that needs to be relative to the camera is a little screwy. To fix all this, I wrote this function a while back to keep an object in the camera's view at all times. It's purpose is to completely replace lock object on.

Here's the function:


The distances and angles passed into the function are all relative to the camera.

After calling this function to position the object, you can point it wherever you want to.



Hope this is what you were looking for.

Edit: Just a thought, you might want to set ZDepthFlag to zero so the arrow you're trying to draw always appears over other objects...
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 9th Mar 2009 08:07 Edited at: 9th Mar 2009 08:55
thanks heaps for this i will go over it and integrate it..

ill let you know how i go.

And thanks for the tip on the ZDepthFlag...

EDIT1: i have got it completely working except for the part when i move the camera back and forward, it does not stay with the camera but lags a bit and needs me to stop to catch up. Is there any way to fix this or is my computer just too slow


here is all the pointer code...


thanks
Kira Vakaan
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 9th Mar 2009 21:39 Edited at: 9th Mar 2009 22:08
Hm, does it? That doesn't make too much sense as the function will always position the object (XDist#,YDist#,ZDist#) units away from the camera. Have you made sure you handle camera movements before updating the pointer position?

Edit: I just did some testing, and using a movement style similar to the one I know you're using, I got the arrow to both keep up with the camera and lag behind it depending on which update I did first. Moving the camera before the arrow is what you want.
lucifer 1101
15
Years of Service
User Offline
Joined: 26th Jan 2009
Location: Melbourne, Australia
Posted: 10th Mar 2009 00:52
thanks heaps that worked perfectly, its just a little shaky...

Login to post a reply

Server time is: 2024-11-25 10:20:09
Your offset time is: 2024-11-25 10:20:09