Jump to content
  • 0

How to set a object to rot using LSL?


brightacs
 Share

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

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

Question

10 answers to this question

Recommended Posts

  • 0

The full discussion can be found here on the rotation options via LSL scripting:

http://wiki.secondlife.com/wiki/Rotation

http://wiki.secondlife.com/wiki/LSL_Rotation_Synopsis

This script will rotate a single prim quite nicely:

default
{
    state_entry()
    {
       llTargetOmega(<0,0,1>,0.1,PI);
    }

}

 

  Function: llTargetOmega( vector axis, float spinrate, float gain );

Rotates the object/prim around axis at a rate of spinrate * llVecMag(axis) in radians per second with strength gain.

• vector axis arbitrary axis to rotate the object around  
• float spinrate rate of rotation in radians per second  
• float gain also modulates the final spinrate and disables the rotation behavior if zero  

Specification

 

Physics

  • If the object is not physical or the script is attached to a child prim, then the effect is entirely client side. Only a script within the object itself can detect this by reading the PRIM_OMEGA parameters.
  • If the object is physical and the script is attached to the root prim, then the physical representation is updated regularly. The rotation experienced by the user can be detected or queried by script.

Link Sets

  • If the script is attached to the root prim, the entire object rotates around the region axis.
    • If the object is attached then it rotates around the attachment axis.
  • If the script is attached to a child prim, the prim rotates around the local axis.
    • A child prim can rotate around its own axis while the entire object rotates around another axis.

Caveats

  • If the object is not physical then the rotation is only a client side effect and it will collide as non-moving geometry.
  • If the function does not appear to be working, make sure that that Advanced > Network > Velocity Interpolate Objects (viewer 1.x) or Develop > Network > Velocity Interpolate Objects (viewer 2.x) is enabled.

 

Link to comment
Share on other sites

  • 0

This might be better discussed in the Scripting forum, but, briefly, there's a distinction between rotating something -- that is, moving if from one rotation to another, like a door moving through 90 degrees and back -- and making it spin.

If you want to make it spin (that is, rotate continuously) you almost certainly need llTargetOmega  or maybe llSetKeyFramedMotion.   

llTargetOmega is probably the most widely used (and it's what people usually mean when they talk about "a rotation script").   In non-physics objects, the rotation is a client-side effect; that is, the object is spinning because your computer is drawing it that way.   As far as the sim is concerned, it's static.   So it wouldn't, on its own, be suitable for a rotating door, but  would be excellent for a cieling fan.

Link to comment
Share on other sites

  • 0

integer link_number=llGetLinkNumber();

llSetLinkPrimitiveParams(link_number,[ PRIM_OMEGA ,<0,0,1>,0.1,PI]);

I used this scripts in the child prims only.then the child prims can rotate separately.But after I used this scripts in the root prim,the three objects rotate together and at the same time the child prims rotate by themself.I want to set the root prim to rotate separately too.How can I do?

Link to comment
Share on other sites

  • 0

Yes. If you call llTargetOmega in a child prim, or -- and this would be better, llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_LINK_TARGET,2,PRIM_OMEGA,<1.0,0.0,0.0>,1.0,0.1,PRIM_LINK_TARGET,3,PRIM_OMEGA..... ]); you can make the prims turn separately. Calling llTargetOmega or PRIM_OMEGA in the root prim causes the whole linkset to turn.

Link to comment
Share on other sites

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