Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

What the avatar's head is looking at...

Drake Bacon
Linux is Furry
Join date: 13 Jul 2005
Posts: 443
02-21-2006 12:01
Now I've poured though the LSL wiki and the forums here... and I'm a bit stumped.

I'm looking for a way of detecting what angles an avatar's head is turned to at any time. I don't mean:
  1. What the agent camera's angle is.
  2. Where the avatar is facing, even though his/her head is turned to the side/up/down and isn't facing forward


An idea would be to attach a tracker object to ether the skull or chin, but experimenting with the chin and having a script whisper to me current position and rotation gets me the same values no matter where the head is looking at.

Any ideas?
Logan Bauer
Inept Adept
Join date: 13 Jun 2004
Posts: 2,237
02-21-2006 12:06
From: Drake Bacon

An idea would be to attach a tracker object to ether the skull or chin, but experimenting with the chin and having a script whisper to me current position and rotation gets me the same values no matter where the head is looking at.

Any ideas?


Yes, I ran into the same things trying to track arm and leg positions. Your script is returning the plain-vanilla position of your avatar, not your avatar's chin. If you attach that same script to your foot, it will return the exact same position as your chin. I do know that in mouselook you can track where you're looking, but AFAIK when you're not in mouselook the most you can do is just get your avatar's rotation and position. :(
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
02-21-2006 12:12
Y'know, I don't think there's a way to do that. I doubt your suggestion of the attachment on the chin won't work since avatar animation is local. You'd need to be able to access the camera anchor, I think, and I can't find any way to do that.

What is it you're trying to achieve? Maybe there's some other way to do it...
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
02-21-2006 13:18
There is no "head" to an avatar any place where the script can get to it.

In-game, an avatar is simply a bounding box. All the complexity of arms and legs and things only exist in the client. That's why (for example) you can target an attachment with particles (client-only effects) but you can't tell where it is in-game... because, in-game it doesn't exist.
Drake Bacon
Linux is Furry
Join date: 13 Jul 2005
Posts: 443
02-21-2006 19:44
Nuts. I was trying to port one of my characters over, a dual-headed anthro-feline. I was hoping to have the head movements tracked so I could move the heads appropriately. Are they sent (or commanded) as animations?
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
02-21-2006 19:51
Never seen an official word on it, but I believe that it's sent as the location the camera is anchored to and the client works out where to point the avatar's head from that.

Nice idea, don't think I've seen any double headed avatars about. Afraid I don't think there's a way to do what you want, although if it's a second head is there any reason you couldn't have it's direction derived from the camera position/rotation? I think it'd be cool to see the two heads turning independently. :)
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
02-21-2006 20:03
llGetCameraPos
llGetCameraRot
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Drake Bacon
Linux is Furry
Join date: 13 Jul 2005
Posts: 443
02-22-2006 09:09
From: AJ DaSilva
Never seen an official word on it, but I believe that it's sent as the location the camera is anchored to and the client works out where to point the avatar's head from that.

Nice idea, don't think I've seen any double headed avatars about. Afraid I don't think there's a way to do what you want, although if it's a second head is there any reason you couldn't have it's direction derived from the camera position/rotation? I think it'd be cool to see the two heads turning independently. :)


That is an idea... Having at least one head keep an eye on where the camera's pointing to, while the other's looking around. That would be a nice alternative, but at the cost of running on the server.

I now have to look at "How to twist a cylendar of a neck and turn the replacement prim head at the same time." Probably some construction details, plus a bit of "How do I turn this object on the client side, with the rotation, and have the client stop it automatically after a period of time."
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
02-22-2006 09:19
From: Drake Bacon
I now have to look at "How to twist a cylendar of a neck and turn the replacement prim head at the same time." Probably some construction details, plus a bit of "How do I turn this object on the client side, with the rotation, and have the client stop it automatically after a period of time."
I'm not totally sure what you mean by the first statement, but get a feeling you may be attempting something that isn't possible...

What you're suggesting in the second statement will likely produce very imprecise results due to the delay between doing things server side and having them implimented client side.

Sorry. :o
Drake Bacon
Linux is Furry
Join date: 13 Jul 2005
Posts: 443
02-22-2006 16:04
Nah, I'm trying to make things easy for me to do, and light on the bandwidth of everyone. As is, it looks like in order for each neck to twist, I'd have to llSetPrimitive() the twist every "frame". I'm hoping I can set the heads apropriately so they can be set to client-side, and then I can set a timer to kill the rotation.
Drake Bacon
Linux is Furry
Join date: 13 Jul 2005
Posts: 443
02-22-2006 16:21
It looks like llRotLookAt for the heads may do what I want to do, if I keep the heads seperately attached (I'm thinking three attachments, the two heads and the comined necks/sholders).

Unfortunately, I have a 5 fps framerate for the necks.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
02-22-2006 17:11
Why don't you link the two heads to your av's eyes, and hide the real head with an invisiprim?
Drake Bacon
Linux is Furry
Join date: 13 Jul 2005
Posts: 443
02-22-2006 19:05
From: Argent Stonecutter
Why don't you link the two heads to your av's eyes, and hide the real head with an invisiprim?


That would mean the two heads would turn together, in sync, and the necks would rotate off the sholders. Not what we need.