Jump to content

Script rotation not rotating?


Lilyana Muircastle
 Share

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

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

Recommended Posts

I'm attempting to make an object sittable for Mystory. I put a copy of a sit and script inside the object that is modify. I'm attempting to fix the problem of her sitting the way she is in the picture but when I edit the vector rotation nothing happens. If I edit the position it works. I am VERY green to all this and was just changing numbers. So please explain it like I'm 5.  Thank you all very much!


vector gPosition = <-0.5, 0.0, 0.2>;
vector gRotation = <0.0, 0.0, 0.0>;  

default
{
    on_rez (integer start_param)
    {
        llResetScript();
    }
    
    state_entry()
    {
        
        llSitTarget (gPosition, llEuler2Rot (gRotation * DEG_TO_RAD));
    }

    changed (integer change)
    {
        
        
        if (change & CHANGED_LINK)
        {
            key av = llAvatarOnSitTarget();
            if (av)
            {
                
                
                llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION);
            }
        }
    }
    
    run_time_permissions(integer perms)
    {
        
        
        if(perms)
        {
            llSetTimerEvent(1.0);
        }
        else
        {
            llSetTimerEvent(0.0);
        }
    }
    
    timer()
    {
        key av = llAvatarOnSitTarget();
        
        if (av)
        {
            llStopAnimation("sit");
            llStartAnimation( llGetInventoryName( INVENTORY_ANIMATION, 0 ));
        }
        else
        {
            
            
            llStopAnimation("sit_generic");
            llSetTimerEvent(0.0);
        }
    }
}
 

LOTD_001.png

Link to comment
Share on other sites

Since the code multiplies the values with DEG_TO_RAD, you should use degrees for the rotation. 90 or -90, depending on direction.

Make sure you're not sitting on the object while you try to change the sit target's position/rotation. You have to stand up and sit again.

Edited by Wulfie Reanimator
Link to comment
Share on other sites

This is one of the few times I'd recommend using llEuler2Rot().

  1. Move (a copy of) your object somewhere out in the open so you can move it around.
  2. Set the rotation of your object to all zeros in the build interface.
  3. Rez a cube
  4. put a sit script in the cube
    • use a script that has a sit target with ZERO_ROTATION, and check that when you sit on it, you're sitting upright and facing due East (cube has 0 rotation)
  5. sit on the cube, move the cube inside your object, rotate the cube to fit.
  6. copy the x,y,z rotation values of the cube from the build menu to your script (the one in the object) as the values of the vector gRotation.
Edited by Quistess Alpha
  • Thanks 1
Link to comment
Share on other sites

I'm pretty sure an empty (all zeroes) rotation vector in a sit target is a bad idea; I always make mine at least <0,0,0.0001> or something.

As for fixing your issue, the post above mine shows a valid way. Myself, I would change the first zero (the "X" slot) in my rotation vector to either 90 or 270. One will put you upside down, one will put you sitting upright. I just don't remember which at the moment, as I'm just now having my coffee.

The red arrow in the editor shows the X axis. It goes through your center and faces forward. Rotating on the X axis will turn you around in a circle without changing the direction you're facing. Like a cartwheel.

The green arrow goes sideways and is the Y axis (middle 0 in the rotation vector). rotating on the Y axis will tilt you forward or backward. Like a somersault.

The blue is Z of course, last 0, and rotates you like a top.

The rest will come to you as you play with this stuff more. For a quick fix, just do as Quistess said.

Edited by PheebyKatz
LOL, i had my X's and Y's all wrong
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 419 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...