Jump to content

Av camera positioning on a moving object


Couldbe Yue
 Share

You are about to reply to a thread that has been inactive for 4130 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have someone writing a script for me where when an av sits on an object the camera moves to the front to effectively look at the av then the object takes off and the camera should move behind the av and follow it as it's being dragged around the place.

The first bit seems to be sort of working - if the camera focus isn't somewhere fixed it works but if it's fixed on something it doesn't (if that makes sense).  When the av takes off though it doesn't change.

I saw this thread http://community.secondlife.com/t5/LSL-Scripting/Need-help-scripting-the-camera-position-orientation/m-p/794943/highlight/true#M850 and can't work out if what I want can be done or not.  As my scripter is one of those who would rather gnaw a limb off than ask for help but my deadline for having the whole build done is immovable (and less than a week away), I'm at a loss to know whether to just abandon this now and go for a redesign or can anyone can give me some clues that I might be able to get him to look at I'd appreciate it.

Link to comment
Share on other sites

I have found if you are not willing to post the code here getting help can be tuff (but never impossible) I do a lot of scripting and I kind of sort of get what you are trying to say,Here is a fact I can answer for you,As a builder and owner of a few shops I know how short dead lines work and the reality of being to far behind to catch up and have a smooth release.Sounds like with less then a week away I would say ditch the idea and move on,you can save it for a later build.

Link to comment
Share on other sites

I haven't seen the script yet only what it does (and doesn't do).  As for stepping into the scripters lair, I'm very well aware of how us nobodies get treated in general whenever we step into these arenas and wouldn't have come in here if I wasn't desperate for some kind of indication of if the idea would work or not.  I learnt the lesson of keeping away long ago and you're right, I should have remembered it before I posted this.

If this were just for one of my releases it could take another decade for all I cared, things get done when they're done but in this case it's not and I'm looking at the days pass and the amount I still have to do.  I've used up all my contingency I'd factored in for the scripting and for the last 3 weeks this script has not managed to do what I want, so I'll file it away as a nice idea that's not doable (I have no concerns about his scripting ability, he's been extremely good with what he's done for me so far, just whether or not it is actually possible) and try to come up with something else to replace that bit of it.. 

hey ho and all that. ;)

 

Link to comment
Share on other sites


... if the camera focus isn't somewhere fixed it works but if it's fixed on something it doesn't (if that makes sense)...

It this means what I think it means, and if it's a deal-breaker, then there's no way to do otherwise in a script.

Scripts only affect the "default cam" -- what you get when you hit the "escape" key a time or two.  Scripts cannot prevent the user from zooming/panning away from that default (as with mouse gestures alt-drag or control-alt-drag), and if the user has already pulled their cam off of default when the script tries to move the cam, nothing will happen until they press the escape key.

Now, if that's not the problem and the script is only intended to affect the default cam, then there's probably a way to do what you want.  Right now, I'm thinking it would be easiest to do it all with separate calls to llSetCameraParams() but because you're scripting a sat-upon object rather than an attachment -- a crucial difference from the cited thread -- it's possible that the first bit (cam facing the AV) could be done with llSetCameraAt- and -EyeOffset, followed by the llSetCameraParams() for the bit where the cam follows the back of the AV.

The cited thread, by the way, hints at another limitation that shouldn't be a problem for you.  Smooth following of  the avatar to which the scripted cam is attached seems to be impossible except from behind.  Luckily, you want that orientation anyway when the AV is moving; even if you didn't, because you have a seated avatar, you could pick backward-facing static eye and focus offsets that would move with the same relative orientation as the object and seated avatar move.

 

Link to comment
Share on other sites

Hi, do you want to simulate the automatic following we get when we alt-click on an object or avatar? I am afraid that the function to do this does not work. llTakeCamera exists as a stub, but it did not survive early testing and it has no effect today.

llSetCameraParams does work, but it can only focus the camera on a point an not an object, so you would have to update it in a loop.

Link to comment
Share on other sites

As I understand it, it's not really that kind of following.

Here's a crude sample of what I think is generally being attempted.  Just drop it in a fresh 0.5m cube, be sure you're in default cam mode (press escape a couple times), sit on the box to get the initial cam-in-front-facing-back-at-avatar effect, then touch it to get the cam-in-back-following-the-avatar's-motion effect.

default{    state_entry()    {        llSitTarget(<0.30, 0.0, 0.6>, ZERO_ROTATION);        llSetCameraEyeOffset(<3.0, 0.0, 1.0>);        llSetCameraAtOffset(<0.0, 0.0, 0.7>);    }    changed(integer change)    {        if (CHANGED_LINK & change)        {            key av = llAvatarOnSitTarget();            if (av)                llRequestPermissions(av, PERMISSION_CONTROL_CAMERA);        }    }    touch_end(integer num_detected)    {        vector myPos = llGetPos();        llSetCameraParams(            [ CAMERA_FOCUS, myPos            , CAMERA_POSITION, myPos + <-3.0, 0.0, 1.0>            , CAMERA_ACTIVE, TRUE            ]);        llSleep(1.5);        integer creeps = 30;        while (--creeps)        {            llSetPos(llGetPos() + <0.5, 0.0, 0.0>);            llSleep(0.25);        }    }}

 It may be instructive to find out how that differes from what's desired.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4130 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...