Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Looking at a wristwatch

EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
08-11-2009 08:59
I'm making a wristwatch. One feature I'd like to include is a cam close-up on the watch face combined with a "glance at wristwatch" animation.

To use llSetCameraParams I need to be able to calculate a camera position close to the watch face (the root prim of an object worn on the left forearm) and pointing in the right direction, i.e. directly above the watch face and looking at its face number 0.

Does anyone have any suggestions as to where I can find code examples for doing this, or does anyone have a code snippet they can share?
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
08-11-2009 09:05
There's no way to locate the actual position of any attached prims.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Vance Adder
Registered User
Join date: 29 Jan 2009
Posts: 402
08-11-2009 09:25
^ Having said that, you might be able to estimate it based on the height of the avatar (as long as you don't need a lot of precision).
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
08-11-2009 09:32
From: Argent Stonecutter
There's no way to locate the actual position of any attached prims.

OK, but could this information be derived from the location and rotation of the avatar, given that the animation will hold the object in a fixed position relative to the avatar? In the absense of an actual position, maybe an implied position will do. (Until the AO kicks in, that is :))

So would it work if I used llSetCameraParams to focus on an offest from the avatar (where the watch will be held by the animation), and from a position offset from the avatar's that'll give the required view?
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-11-2009 09:41
You could use a particle or temporary rezzed object instead. Blow up the watch face as a virtual representation of the avatar, "looking at it."
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
08-11-2009 10:25
From: EF Klaar
OK, but could this information be derived from the location and rotation of the avatar, given that the animation will hold the object in a fixed position relative to the avatar? In the absense of an actual position, maybe an implied position will do. (Until the AO kicks in, that is :))
The rotation of the avatar reported to the sim is off by up to 30 degrees in either direction from what any user (including the avatar itself) sees. You'd be better off having the watch appear in a center-attached HUD position when they "look at it".
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
08-11-2009 12:41
force mouse look?
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-11-2009 13:09
From: Argent Stonecutter
...attached HUD position when they "look at it".

Ah. A HUD attachment. That's a good one.
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
08-11-2009 13:14
OK, let's say this isn't about looking at attachments.

Given any arbitrary prim with a known position and rotation, how would I calculate a position 1 metre away from it along its Z axis?
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
08-11-2009 13:42
Most fancy watches I have seen in SL have two parts. One is what you wear on your wrist. the other is a HUD with a detailed version of the watch face.

The reason for this is that even if you ovecome the issue of how to make the avatar position their body and head appropriately, and look at the watch on their wrist, you can only get a camera just so close to the avatar's body. And it is not close enough, unless the watch is oversized and crudely detailed.

Try this. Stand on a pose stand, so your arm can not move, and wear the watch. Now try to manually position the camera to get a close-up view of the watch that you are wearing. Aim right at the watch, and try to get close. I'll lay pretty good odds you can not get the camera close enough to make it look decently detailed.

My recommendation? Make a custom animation for "Look at my watch", but don't move the camera to look at the actual watch on your wrist. Instead, activate the animation by clicking on a reduced version of the watch face, worn as a HUD on your screen, and have the watch face enlarge and center that HUD on the screen while you're "looking at it". Click the watch face again to reduce it back to one corner, and release your avatar from the "look at my watch" pose.

I've tried making watches myself, as an excercise in scripting and design. Never sold mine, because I was dissapointed that I couldn't actually look closely at the one I was wearing, and neither could anyone else.
_____________________
Sorry, LL won't let me tell you where I sell my textures and where I offer my services as a sim builder. Ask me in-world.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-11-2009 13:44
From: EF Klaar
OK, let's say this isn't about looking at attachments.

Given any arbitrary prim with a known position and rotation, how would I calculate a position 1 metre away from it along its Z axis?

Any unattached prim? No problem:
CODE

vector getPosAbove(vector primPos, rotation primRot, float distanceAbove)
{
return primPos+distanceAbove*llRot2Up(primRot);
}
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-11-2009 13:47
From: Ceera Murakami
Most fancy watches I have seen in SL have two parts. One is what you wear on your wrist. the other is a HUD with a detailed version of the watch face.

The reason for this is that even if you ovecome the issue of how to make the avatar position their body and head appropriately, and look at the watch on their wrist, you can only get a camera just so close to the avatar's body. And it is not close enough, unless the watch is oversized and crudely detailed.

Try this. Stand on a pose stand, so your arm can not move, and wear the watch. Now try to manually position the camera to get a close-up view of the watch that you are wearing. Aim right at the watch, and try to get close. I'll lay pretty good odds you can not get the camera close enough to make it look decently detailed.

My recommendation? Make a custom animation for "Look at my watch", but don't move the camera to look at the actual watch on your wrist. Instead, activate the animation by clicking on a reduced version of the watch face, worn as a HUD on your screen, and have the watch face enlarge and center that HUD on the screen while you're "looking at it". Click the watch face again to reduce it back to one corner, and release your avatar from the "look at my watch" pose.

I've tried making watches myself, as an excercise in scripting and design. Never sold mine, because I was dissapointed that I couldn't actually look closely at the one I was wearing, and neither could anyone else.


I think the camera distance issue is mostly a problem with the viewer UI (often you can get the camera closer by placing the focus point--the place you click--on a spot behind the avatar instead of on it or an attachment), though the near clipping distance could cause problems as well. IF you could actually calculate the position of the attachment you MIGHT be able to position the camera adequately via script. But those are big 'ifs' and 'mights'. The HUD attachment is a grand idea IMO.
EF Klaar
Registered User
Join date: 11 Jun 2007
Posts: 330
08-11-2009 14:44
From: Hewee Zetkin
Any unattached prim? No problem:
CODE

vector getPosAbove(vector primPos, rotation primRot, float distanceAbove)
{
return primPos+distanceAbove*llRot2Up(primRot);
}

Thanks for that :) Now whether I can do anything with it remains to be seen, but that snippet will have saved me weeks of trial and error.

I've taken a screen shot, but haven't been able to upload it here; I'll give it to you in-world, Ceera. If I could manage something like that from a script, I'd be happy to use it. I confess this is more to do with stylistic whim than with pure useability. But it would be a nice touch :)

I can't use a texture on a particle or prim because the watch hands are prims that move to tell the time.

The watch is designed to be used as a HUD, it is indeed much easier to use like that, and that is how I use it myself. But seeing as how it can be shrunk down to a dial diameter of 25mm, it'd be a shame not to use it as a wrist ornament as well :)
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
08-12-2009 11:25
From: Void Singer
force mouse look?


If you know a viwer that can do this without a sit please tell :)

The BDSM scene is waiting for it
Nika Talaj
now you see her ...
Join date: 2 Jan 2007
Posts: 5,449
08-12-2009 11:34
From: Hewee Zetkin
Any unattached prim? No problem:
/me grabs the code and runs away.

1 thread lurker thanks you!
:)
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
08-13-2009 14:42
From: Beverly Ultsch
If you know a viwer that can do this without a sit please tell :)

The BDSM scene is waiting for it

whoops, was thinking it worked in attachments, but I guess not =/
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -