|
Sorazoe Dodonpa
Registered User
Join date: 21 Nov 2006
Posts: 12
|
03-16-2007 16:27
Hello, I've had this Idea for SL that I've been wanting to do for awhile, but I'm still having a little trouble understand how to do it.
My idea that I want to do is take a prim and add in a script where it will cause it to float right where the user's camera is and point in the direction the camera is pointing.
the idea came from when I saw a few people back in janurary where they had these little Navi fairies flying above their shoulders, no animations and it looked like they were just connected to the shoulder of the avatars. so I got to thinking "How can I make it so that they are actually where the camera is?"
I figured that it would require commands like llGetCameraPos and llGetCameraRot
But that still comes up with the issue on how to get it down into the right script setup...
So can I get a little help with it, or atleast some advice on how to conjure up a script for it?
|
|
Talon Brown
Slacker Punk
Join date: 17 May 2006
Posts: 352
|
03-16-2007 17:20
In the script library on lslwiki.net I found the following Camera Follower script. It does most of what you want with the exception of rotation but uses physical movement which I personally didn't care for so here's the same basic script with rotation and non-physical movement. I've tested it and it works but probably could use some fine-tuning as well. (Not too keen on it using channel 0 either.) integer channel = 0;
default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_TRACK_CAMERA); } run_time_permissions(integer perm) { if (perm & PERMISSION_TRACK_CAMERA) { state camera_captured; } } }
state camera_captured { state_entry() { llListen(channel,"", llGetOwner(), ""); llSetStatus(STATUS_PHANTOM, TRUE); llSetTimerEvent(0.1); } timer() { llSetPos(llGetCameraPos()+<0.0, 0.0, 1.0>); llSetRot(llGetCameraRot());
} listen(integer channel, string name, key id, string message) { if (llToLower(message) == "hold") { state camera_captured_disabled; } } }
state camera_captured_disabled { state_entry() { llListen(channel,"", llGetOwner(), ""); } listen(integer channel, string name, key id, string message) { if (llToLower(message) == "follow") { state camera_captured; } } }
|
|
Simil Miles
Creator
Join date: 1 Mar 2007
Posts: 300
|
03-17-2007 02:58
This was the second object I tried to make when I arrived in SL. Be sure not to rotate the root prim while building the object or it won't be facing the good direction. Also be sure to add a mechanism to stop it to follow, or you'll have to catch it by being faster than it.
_____________________
UnConWTech @ Flo (144, 84, 224) http://unconwtech.free.fr
SL books http://astore.amazon.com/secondlife-sl-20/
Need a beta tester for quality assurance ? Need a translator for English, French, Spanish ?
|
|
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
|
03-17-2007 04:09
Heh, I did one of these too - a big eyeball, I like to freak out newbies with it. Note that you'll need more complex code than what's been shown so far if you want it to be able to follow across sim borders. Also, you should have a timer to delete it if it looses you.
|
|
Sorazoe Dodonpa
Registered User
Join date: 21 Nov 2006
Posts: 12
|
03-17-2007 10:40
Well it works yet doesn't.... I wanted it to be a part of a worn object for those areas that wont allow you spawning or building objects in, so when its worn it just floats there above the avatar at the same height for different locations where it was snapped onto.
BUT I can use this and alter it a little so its just the rotation so it will have, like what with the eyeball that AJ DaSilva did. just have it floating off to the side of the avatar and it would point strait at what you're looking at.
but yeah there are at least one other issue with it (excluding the command on and off which I'm gonna look into some of the scripts i found for figuring out how to do the command on an doff) the other issue is that, or at least for me, it is a bit laggy in movement, it seems to jump about when you move the camera, which was how i was able to stop it to get it into my inventory. anyway, thanks for the help, I'll look into trying a few different things, first thing first though... i need to make a enable and disable movement
|
|
Talon Brown
Slacker Punk
Join date: 17 May 2006
Posts: 352
|
03-17-2007 13:55
Umm, just to clarify one specific thing, the script from the library does have enable/disable commands already included. Saying "hold" stops it from moving, saying "follow" makes it start following again. Hence my comment about my not being too keen on it listening to channel 0.
|