INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Locking objects to screen

Locking objects to screen

(OP)
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.

RE: Locking objects to screen

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.

RE: Locking objects to screen

(OP)
Thanks! VERY HELPFUL!

RE: Locking objects to screen

(OP)
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.

RE: Locking objects to screen

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close