Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Keyboard events keep recentering the camera.

Phate Shepherd
Addicted to code
Join date: 14 Feb 2008
Posts: 96
02-08-2009 22:09
I'm writing a script that changes animations based on keyboard control (up/down/left/right/etc.) It appears that after every keypress, the camera position is reset.

Is there a way to "unlock" the camera, so that if a user presses a key (which in turn changes the current animation(s) playing) that the camera will be left wherever the user has it set?

Thanks!
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-09-2009 01:53
You might be able to get the camera position and then set the camera position to the same position and rotation. See:

http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetCameraPos
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llGetCameraRot
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSetCameraParams

and generally:

http://www.lslwiki.net/lslwiki/wakka.php?wakka=camera

Note that you won't exactly be able to set the camera rotation, but you could calculate a point in front of the camera given its current rotation and set its focus position based on that.
Phate Shepherd
Addicted to code
Join date: 14 Feb 2008
Posts: 96
02-09-2009 08:48
I'll tinker with that...

Something tells me that the camera movement happens before I can intercept its current position. It's worth a shot though, thanks.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-09-2009 14:18
From: Phate Shepherd
I'll tinker with that...

Something tells me that the camera movement happens before I can intercept its current position. It's worth a shot though, thanks.

Most likely, yeah. You'd probably want to be monitoring the camera pretty closely, and setting its position constantly or at least when it hasn't moved in a bit. I do hope the camera tracking gives the camera's ACTUAL position, even when alt-zoomed, but I can't really remember. It's probably worth some initial testing before you dive into a full attempt.