Jump to content

RLV and @setrot


Paul Hexem
 Share

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

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

Recommended Posts

From my HUD:

        llOwnerSay ("@setrot:" + (string) (rotate_to * DEG_TO_RAD) + "=force");

It works fine for me. The RLV API wiki page does say that it's not very precise and won't work at all on small angles, but my own experience is that it's precise enough for my needs. I've not checked how small the smallest angles I've thrown at it are, but I've had no trouble there, either.

Presumably you're getting the "executed ok" message with RLV debug turned on?

Link to comment
Share on other sites

No, it's simply not turning at all with any of the rotations I feed it. Could be an issue in how I'm getting the rotations, though. That's why I'm wondering if someone has a snippet of a working method of getting a rotation to put in there.

Edit: This is what I'm currently using. I've tried a few other things, but this seemed like it should have been the most straightforward.

vector fwd = <1,0,0>*llGetRootRotation();
float angle = llAtan2(fwd.x, fwd.y);
llOwnerSay("@setrot:" + (string)angle + "=force");
llStopMoveToTarget();

Theoretically that should get the current rotation while moving, then tell the avatar to turn in that direction when stopping, but it just doesn't happen.

Edited by Gadget Portal
Link to comment
Share on other sites

There's an example of how to use it in Kira Komarov's Quick Collar script in the wiki  (the moveTo userfunction): http://wiki.secondlife.com/wiki/Quick_Collar which looks like things I've done with @setrot in the past.

The API warns that 

Quote

this command is not very precise, nor will do anything if the action attempts to rotate the avatar by less than 10° (experimental value, it has been mentioned somewhere that 6° was the minimum). In other words, it is best to either check with a llGetRot() first, or to make the avatar turn twice, first 180° plus the desired angle, then by the angle we need. It isn't very elegant but it works.

http://wiki.secondlife.com/wiki/RestrainedLifeAPIKi

The wiki example isn't, I think, very helpful, in that it points you in the direction you're already facing, so nothing much is going to happen.   The Quick Collar example (which turns the collar wearer to face towards whoever is dragging her) is more practical.     You could try looking through the Open Collar scripts and seeing how they do it (that's where I learned it from).

If you can't get it to work, I must have a working example somewhere that I've made -- I'll look it out if necessary.

 

Edited by Innula Zenovka
  • Thanks 1
Link to comment
Share on other sites

In case anyone has a similar problem, this works:

vector pointTo = target - llGetPos();
float  turnAngle = llAtan2(pointTo.x, pointTo.y);
llOwnerSay("@setrot:" + (string)turnAngle + "=force");

Where "target" is a vector, from llGetObjectDetails or a sensor or whatever means you use.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

  • 5 months later...

Does anyone know what to use to disable the forced camera position while using @setrot command ? ... I'd like to be able to move my camera around when using this. Whenever this moves my avatar it always takes control of the camera and locks the camera position to the upper rear of my avatar, so I have no camera control while being rotated …

                    diff = targetPos - myPos;   
                    float pointTo=llAtan2(diff.x, diff.y);
                    string rlvcmd = "@setrot:" + (string)pointTo + "=force";
                    llOwnerSay(rlvcmd);      

@setcam_unlock=y … @setcam=<n|y> ... @setcam=n … are the camera commands I've seen, but I haven't seen any examples of anyone releasing the camera while being rotated. Is there a parameter for this with @setrot, or a way to use one of these other commands here in conjunction with it ? Anyone have an example segment of script that would help me ?

 

Link to comment
Share on other sites

I considered using run time permissions to just set the scripted camera control to inactive but, what I want to do is allow the camera control to follow the @setrot command until I, the user, click on the camera controls to move the view. I also need the same thing for movement controls. I know this has to be somewhere in the Open Collar leash following stuff. I already have movement controls releasing and passing thru for the move to part following the avatar but, the only way to rotate myself is with this @setrot and I'd like it to have control of movement and camera until I move my arrow keys for movement and/or camera at which time I need @setrot to release control to the user. Then if the user stops input to take back over again.

Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...