how to get key of root prim of arbitrary objects?
|
|
Capstan Clift
Registered User
Join date: 14 Dec 2006
Posts: 3
|
02-06-2008 08:07
I want to be able to obtain the key of the root prim of whatever object I click on with the mouse. Is there a function or combination of functions that will retrieve that? I know it is possible to get the key if you have a script attached to the object that will respond to a touch event, but I want to get the root prim key of any arbitrary object even if I don't own it, and therefore can't put a script in it.
It looks like it is possible to detect objects within a certain radius using the sensor() function and get info about them, but that isn't the same as selecting specific objects with the mouse. Also it looks like it might be possible to do something with the collision functions, but once again this appears to be related to scripts in objects that respond to someone bumping into them. I don't know if you could be wearing something that had collision detection in it, for example, and select objects by bumping into them? I'd prefer using the mouse though.
Any suggestions much appreciated!
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
02-06-2008 09:30
Collisions would work as you describe.
You might also try the debug console from the Client menu (if you don't see the Client and Server menus at the top of the screen, press CTRL-ALT-D). The key combination for the debug console is also CTRL-SHIFT-4, but I think you might still have to have the Client and Server menus visible for it to work. I don't know if that will give you the information you want, but it might be worth trying out. Unfortunately, you can't capture that data programmatically (without a custom client) or even copy/paste from it. PITA.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
02-06-2008 10:04
the mouse is right out the window, barring some obscure debug command in the viewer I don't know about... but you could always "shoot" the object you want to grab the key of. come to that a sensor (with a narrow arc) that works like a gun would work too.
_____________________
| | . "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... | - 
|
|
Capstan Clift
Registered User
Join date: 14 Dec 2006
Posts: 3
|
02-06-2008 10:09
Thanks so much for that info. Its seems odd that you can't get the key with the mouse directly. I like the idea of shooting the target object with a projectile object that contains a sensor though, might work. I do want to obtain the key programatically if at all possible. Any other suggestions would be most welcome.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
02-06-2008 10:16
From: Capstan Clift Thanks so much for that info. Its seems odd that you can't get the key with the mouse directly. I like the idea of shooting the target object with a projectile object that contains a sensor though, might work. I do want to obtain the key programatically if at all possible. Any other suggestions would be most welcome. slight misunderstanding, if you shoot the object with a projectile you'd just use the collision event to catch it, I'm not sure if you could build the sensor directly into a gun like object (that doesn't fire projectiles) but you could certainly rez a sensor with the correct orientation, without needing to move the sensor like a bullet.
_____________________
| | . "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... | - 
|
|
Capstan Clift
Registered User
Join date: 14 Dec 2006
Posts: 3
|
02-06-2008 11:11
I'm a little confused. Are you suggesting that I could be carrying a gadget that had a sensor script that would tell me the root prim key of an object that I happen to be facing for example? Or would I have to rez a prim with the correct orientation somehow every time I want to get the key for the nearby object?
Is it feasible to shoot the object with a prim which reports the collision event (plus key info, etc) of the target back to me as you appear to have been saying? Or did I misunderstand?
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
02-06-2008 17:49
collisions can gather the same information as touch or sensors through the use of llDetected* functions (like key, pos[ition], rot[ation], and name) so you're bullet would check llDetectedKey and report it to either you or another script via chat.
the sensor may be more difficult, since I've never really played with gun scripts to understand how they aim, but even if that is unfeasible, you could use a camera follower (tracks camera position and rotation, and matches them to aim the sensor)
can't remember if there's a workaround for no-rez land for bullets (not sure if temps obey it or not).
if you can get the sensor to obey the gun aiming rules it'd be the best overall solution, although everything suggested here assumes you're in mouslook, otherwise aiming becomes dificult at best
_____________________
| | . "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
|
02-06-2008 22:46
Sensors in attachments ALWAYS look from the avatar's position. Even HUD attachments don't use the camera position, unfortunately. That means you can come CLOSE when in mouselook, but again it is not QUITE accurate because the mouselook point of view is displaced from the center of the avatar. So while you can point in the same direction as the camera, you'll have some parallelax type issues. o----------> (mouselook camera) /|\ |----------> (sensor) /\

|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
02-06-2008 23:58
which is why I suggested a cam follower (that and not knowing the specifics of how and where guns scripts aim from)
presumably you could solve paralax by creating an object whose sensor is in a child prim with a +z offset equal to the distance between the hip joint and the head, then geting it's updown orientation from the camera offset.
_____________________
| | . "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
|
02-07-2008 01:19
From: Void Singer which is why I suggested a cam follower (that and not knowing the specifics of how and where guns scripts aim from) Gun scripts are basically the same, but you can account for the offset with them, since rez location is arbitrary within the 10m limit, not tied to the vector direction of the velocity or anything. From: someone presumably you could solve paralax by creating an object whose sensor is in a child prim with a +z offset equal to the distance between the hip joint and the head, then geting it's updown orientation from the camera offset. I don't think so. As I recall, anything from anywhere in an attachment, whether child prim or root prim, senses from the avatar's origin facing along the avatar's x-axis. Annoying, but there it is. You could rez an object to do the sensing (for which cam following would work fine), but then we're back to the same build restriction problem of the projectile solution (well, except maybe that object entry won't block it across parcel boundaries).
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
02-07-2008 03:49
I knew it was that way for root prims, but I thought child prims would use their offset from the root... never tested it myself =/
_____________________
| | . "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... | - 
|