Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Camera follow position

Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
07-09-2009 17:51
I'm using this script to cause an object to follow my camera. It seems to work fine, except it puts it behind my camera- I can't see where it is. I understand that I'd have to adjust the llMoveToTarget numbers, but I can't seem to get the object to move to a spot in front of my camera. Any suggestions?

CODE


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_PHYSICS,TRUE);
llSetTimerEvent(0.1);
}
timer() {
llMoveToTarget(llGetCameraPos()+< 0.0,0.0,1.0>,0.1);
}
listen(integer channel, string name, key id, string message) {
if (llToLower(message) == "hold") {
state camera_captured_disabled;
}
}
}

Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-09-2009 23:57
llGetCameraPos() + < 1.0, 0.0, 0.0 > * llGetCameraRot()
_____________________
|
| . "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...
| -
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
07-10-2009 00:04
Is something missing? That gives me a syntax error.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-10-2009 00:12
it's a replacement for this segment:
llGetCameraPos()+< 0.0,0.0,1.0>
and puts the new position 1m in front of the camera (tweak the offset to your hearts content)
_____________________
|
| . "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...
| -
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
07-10-2009 00:18
Hmm. When I switch it out, it stops working completely.

I have llMoveToTarget(llGetCameraRot()+< 1.0,0.0,0.0>,0.1)

And it tells me function call mismatches type or number of arguments.
Basement Desade
Registered User
Join date: 14 Jul 2006
Posts: 91
07-10-2009 00:27
Hey Void,

Paul and I are both working at this, and not getting it. We assumed that is what you meant, but when we put it in, the script won't compile. Would you please post the script with your changes, so we can see what we're missing?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-10-2009 02:25
only syntax error I got was on using the above code (because it's missing the disabled state), but here's what I put...

CODE

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() {
llSetStatus( STATUS_PHYSICS, TRUE );
llSetTimerEvent( 0.1 );
}
timer() {
llMoveToTarget( llGetCameraPos() + < 1.0, 0.0, 0.0 > * llGetCameraRot(), 0.1 );
}
}
_____________________
|
| . "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...
| -
Paul Wardark
Wait, what?
Join date: 10 Jan 2009
Posts: 383
07-10-2009 02:36
Unfortunately, I just put that into my object here... And it doesn't do anything.
Opensource Obscure
Hide UI
Join date: 5 Jun 2008
Posts: 115
07-14-2009 08:29
Thanks Void, that worked for me - just remove the space after 'TRACK' in the 5th line:

llRequestPermissions(llGetOwner(),PERMISSION_TRACK_CAMERA);
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
07-14-2009 10:39
::kicks forum software:: stupid insertion code...
_____________________
|
| . "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...
| -