Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Camera orbitting

Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
06-18-2008 20:21
When you hold down the alt key while pressing the left or right arrow keys, you orbit the camera around the avatar as the focus. You can end up looking at the avatar from any angle. Once you orbit the camera to a given position, if you press the up arrow to start walking, the avatar turns in the direction the camera is pointing.

I'm trying to accomplish the same thing using LSL. I've experimented with this all night using the various set commands related to the camera. I can't seem to get the hang of how these camera controls work and how to accomplish what I described above.

Can someone get me started with this? Specific help with this problem would be nice. I'd also appreciate any pointers to general tutorials on how to use these commands. (I have read the wiki, but it's still clear as mud).
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
06-19-2008 05:53
What I think is being described won't happen because the "scripted cam" does not affect the "normal avatar cam" the same way that alt-zooming does (to adopt the nomenclature under "Camera Modes" in http://lslwiki.net/lslwiki/wakka.php?wakka=camera). So, when the script releases cam control, the avatar isn't going to spin around like it does with alt-zoom (or at least it doesn't seem to, in my experience).

If the question is more generally about how to do cam control scripts, Torley has collected a bundle of them at his digs in Grasmere that show some of the tricks.
_____________________
Archived for Your Protection
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
06-19-2008 08:15
You can orbit the camera from script, but it's slow - the script has to manually do all of the geometry necessary to calculate where the camera goes. I can get it to acceptable speed on Mono, but not on the standard VM.

You can't rotate an avatar from script, so you'd have to grab the Up Arrow key and push the avatar instead, which would probably look rather ugly. :(
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
06-19-2008 15:27
Well that explains why I was not able to reorient the avatar after a scripted camera change like I can with alt-zoom by just pressing the esc key. I thought I was missing something. I had been hoping to move the camera via script and then be able to quickly reorient the avatar with a quick hit to the esc key.

I also had thought that "the camera is the camera is the camera". But apparently not. I still don't totally understand the differences despite reading the site referenced by Qie. If anyone else could recommend some good references to all these camera modes, I would appreciate it. A tutorial on how to use the various llSetCameraParams would be helpful too. Otherwise I guess the way to learn it is by trial and error.
Yumi Murakami
DoIt!AttachTheEarOfACat!
Join date: 27 Sep 2005
Posts: 6,860
06-19-2008 19:52
From: Monica Balut

I also had thought that "the camera is the camera is the camera". But apparently not.


There are actually 2 cameras. There's the standard camera and the user camera. The user camera is the one you're using when you alt-zoom. The user camera, when it's active, overrides the standard camera completely. The standard camera is the one you control with llSetCameraParams. So if you are in the middle of using alt-zoom when an llSetCameraParams occurs, your camera won't move at all - it updated the standard camera but you are using the user camera right now, and will carry on doing so until you do something that makes you go back to the standard camera (pressing ESC or moving your avatar).
Koralo Revnik
Registered User
Join date: 19 Jun 2008
Posts: 8
06-19-2008 20:45
From: Yumi Murakami
There are actually 2 cameras. There's the standard camera and the user camera. The user camera is the one you're using when you alt-zoom. The user camera, when it's active, overrides the standard camera completely. The standard camera is the one you control with llSetCameraParams. So if you are in the middle of using alt-zoom when an llSetCameraParams occurs, your camera won't move at all - it updated the standard camera but you are using the user camera right now, and will carry on doing so until you do something that makes you go back to the standard camera (pressing ESC or moving your avatar).


This is interesting. Do you know if a script can fully disable the standard cam? Only use the one you set with llSetCameraParams?
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
06-19-2008 21:40
And which do you examine with llGetCameraPos() and llGetCameraRot()?
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
06-20-2008 04:47
From: Koralo Revnik
This is interesting. Do you know if a script can fully disable the standard cam? Only use the one you set with llSetCameraParams?
Well, in this nomenclature, the "standard cam" *is* the one set by llSetCameraParams. As for a script completely overriding the "user cam": Not on purpose. :p (There are some glitches in the cam control functions... I've never actually wedged what we're calling the "user cam" here, but the default tracking location of the "standard cam" after releasing scripted control may be Not Quite Right--but non-reproducibly, as far as I've been able to determine. (Usually when this happens, my regular unscripted cam ends up wanting to follow me around at about the correct height for a tiny, so if one could harness this glitch for the Forces of Good...)
From: Hewee Zetkin
And which do you examine with llGetCameraPos() and llGetCameraRot()?
(Easy for me to test. :D ) These functions return the pos & rot of whichever cam is active for the agent at the time. That is, (in this nomenclature) if one has alt-zoomed off from the "standard cam" position, the functions return the alt-zoomed "user cam" coordinates.
_____________________
Archived for Your Protection
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
06-20-2008 05:30
The wikis talk about two other functions that allow you to "set" things: llSetCameraAtOffset and llSetCameraEyeOffset. They specifically talk about using these in conjunction with sitting on an object and there is no mention of using them in an attachment. This made me think there was a 3rd camera mode. Do these control the "standard" camera in the same way as llSetCameraParams? Do they provide the same functionality as can be found using llSetCameraParams, or do they have a specific use in and of themselves?
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
06-20-2008 06:57
The llSetCameraAt- and -EyeOffset functions control the "standard" cam, I guess, since they also are what one returns to when pressing Escape after alt-zooming. They are actually prim properties, so if you set them and remove the script from the prim, they still work. And a scripted llSetCameraParams will take over from wherever your cam is set by the prim properties.

But the behavior of the cam when sitting is a slightly different beast anyway. If one sits on a prim without the cam properties set, one can swivel the cam around and zoom it with the arrow keys, and return to the default cam position with the Escape key (so, in this nomenclature, one might say that the arrow keys are manipulating the "user" cam). But that's defeated by cam properties if they're set in the prim: the arrow keys don't move the cam in that case. On the other hand, alt-zooming still works to control this "user" cam even when you're seated on a prim with cam properties set.

(I think that alt-zoom and the goofy View / Camera Controls things are essentially synonymous. It's been a really long time since I've used those Camera Controls, though.)

I honestly don't know how best to describe "cams" and "cam modes". I agree that this "Camera Modes" section of lslwiki's "camera" page is terse at best and possibly confusing, but I'd be hard-pressed to come up with something more coherent.
_____________________
Archived for Your Protection
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
06-20-2008 12:21
Thanks for clarifying that Qie. That was very helpful. So it sounds from your explanation that those two functions only work on non-attached objects when they are being sat upon. Have you ever tried to use them with something attached or perhaps a HUD?

I guess the way to learn this, like everything else is to just start playing with this.
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
06-20-2008 14:49
From: Monica Balut
Have you ever tried to use them with something attached or perhaps a HUD?
Can't say that I've tried it, but I'm pretty sure they wouldn't work. I really think of them as analogous to llSitTarget(). But everything they can do and more, llSetCameraParams() can do from either an attachment or a seat (using slightly different geometry to specify the cam position and orientation).
_____________________
Archived for Your Protection