Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locking objects to screen

Status
Not open for further replies.

Zell49

Programmer
Sep 19, 2005
5
US
Can someone please help me? Is there anyway to effectivly lock an object to the screen without the lock object on x command? whenever I use this, my object seems to be messed up. If someone could tell me what Im doing wrong, or another method, I would be greatly obliged.
 
1: You might do it this way when you want to create an fps:

`get camera values
posx# = camera position x()
posy# = camera position y()
posz# = camera position z()
angy# = camera angle y()
offsetx# = 1.0
offsety# = 1.0

`work out gun position
gunx# = newxvalue(posx#,wrapvalue(angy# + 90), offsetx#)
gunz# = newzvalue(posz#,wrapvalue(angy# + 90), offsetx#)
guny# = posy# - offsety#

`update gun
position object gun,gunx#,guny#,gunz#
set object to camera orientation gun

2:
Your minimum camera range might be too big, becoming parts of the gun not visible.
Try using the code

set camera range 0.01,10000

wich sets the minimum camera range to 0.01 and max to 10000.
 
Like I said great concept. I tried to set the minimum camera range to .01, but I reveived an error. So the other part worked pretty well, but is there an easy way to keep it on the screen when you look with the mouse? I have the look with the mouse part, and I can keep it in the screen, but it is a little choppy because I had to use a pretty complex math equation I made to move the object. It has to recalculate the positions everytime I move the mouse, and I was wondering if there was a faster way? Or am I just retarted and can't set the camera range right? I put the code in just like "set camera range 0.01,5000". Any tips? If not, what I have now works.
 
Mmm, maybe put 0.1 instead of 0.01.
set camera range 0.1,5000

Any other ways? I don't think so. Math and lock object on are the only commands that can help you through this problem I think.
Tip: use the "disable zdepth nr" command to make the gun always apear on top of other objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top