Jump to content

Rotating to a Halt


LissomePrey
 Share

Recommended Posts

I am trying to get an object (table) to spin round the z axis gradually slowing and ending up aligned to a compass point.

I have got the slowing working fine but I am having problems getting it to stop aligned and would welcome any suggestions.

My first thought was llGetRot() as it slowed past a certain speed of rotation and stopping when it next hit a compass point but llRot2Euler(llGetRot()) always seems to return a zero rotation for me.

Would be grateful for any thoughts, suggestions or pointers to scripts.

Link to comment
Share on other sites

If you have been "rotating" with llTargetOmega, the servers don't have any idea that you have been doing it.  All llTargetOmega rotation is client side.  When you query llGetRot(), you'll see that nothing has changed in the servers.  So, if you want to stop at a specific spot, you have to rotate with llSetLinkPrimitiveParams  ([PRIM_ROTATION]) as well as llTargetOmegaThen stop both.

Link to comment
Share on other sites

Thanks for the help.

llSetLinkPrimitiveParams  ([PRIM_ROTATION]) sets it to a specific rotation if I read correctly? So I'd need to do my own calculationof how far it had rotated at each time interval if I went that way.

I guess the best bet is to calculate roughly what starting speed of llTargetOmega would get me to each compass point (results of course are not exactly repeatable) and then as speed of rotation gets to zero, correct with llSetLinkPrimitiveParams  ([PRIM_ROTATION]). I thought this was going to be an easy one, very foolish.

Link to comment
Share on other sites

Yes, that's right.  You put the SLPPF function in a timer loop and let it increment the rotation in discrete steps of 10 degrees or so while llTargetOmega is showing you a smooth rotation on your client.  The stepwise rotation will be in the background, not seen by your viewer until you stop everything.  It's not hard, really.  After all, you can apply the same calculated rotation to both functions.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...