Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

how to locate the exact position where avatar is looking

Varun Blitz
Registered User
Join date: 22 May 2008
Posts: 62
06-02-2008 23:24
hi,

friends when i use a gun, does it finds the exact position where my avatar is looking or only the rot and then follows some constant displacement to fire the bullet.
but then i may look at infinity and fire. so how can i find the exact position where my avatar is looking ?? what if it looks at infinity ??
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
06-03-2008 00:53
You can't get the specific "point" your avatar is looking at from a script. Actually you can't look at a specific point in mouselook even; only when you alt-drag on a point does that happen. Any other time you are looking in a specific DIRECTION. To know the direction you are looking all you need is a vector and the understanding that you are "looking at" every point along a ray along which that vector points. To get a unit vector in the direction the avatar is pointing from an attachment, use llRot2Fwd(llGetRot()).
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
06-03-2008 05:55
Guns only go by the rotation of your avatar. Your avatar's vision is defined by the line along which they are looking; there is no concept of them focusing on a particular point along that line. Thus, you can't "look at infinity", and just in the same way you can't look 1m in front of you - there are no controls to do either.

If you really want to find the exact location of the viewpoint you can use llGetCameraPos() and llGetCameraRot() - although guns don't use these. However, even these will only give you the line of vision, not a focus point. (Using alt-look doesn't create a focus point.)
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
06-03-2008 08:11
From: Yumi Murakami
(Using alt-look doesn't create a focus point.)

Well, it does (you can see such focus points using an Advanced menu option), but a script can't retrieve it.