Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Rotation Rotate Child Prim  

Rotate Child Prim

Drop this one in a child prim to have it rotate around the world's Y axis in 1 degree increments. It won't work in the root if it is rotated.
You have to send it a message "[BTN_1]" on channel -101 as it is intended for a HUD

Category: Rotation
By : Ferd Frederix
Created: 2014-12-17 Edited: 2014-12-17
Worlds: Second Life

the Zip file

Download all files for Rotate Child Prim
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Script.lsl

This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1
2 rotation rot_xyzq;
3
4 default
5 {
7 {
8 vector xyz_angles = <1,1,0>; // This is to define a 1 degree change in X axis
9 vector angles_in_radians = xyz_angles*DEG_TO_RAD; // Change to Radians
10 rot_xyzq = llEuler2Rot(angles_in_radians); // Change to a Rotation
11
12 llListen(-101,"","","");
13 }
14
15 listen(integer channel, string name, key id, string message){
16 //If owner do something
18 if(message == "[BTN_1]") {
19 llSay(0, "Button 1 pressed");
20 llSetRot(llGetRot()*rot_xyzq/llGetRootRotation()/llGetRootRotation()); //Do the Rotation...
21 // Get the prims rotation. Add (*) to that the new rotation, and subtract (/) the root rotation twice
22 // You subtract it twice because the Lindens screwed up the math.
23 }
24 }
25 }
26 }

Back to the Best Free Tools in Second Life and OpenSim.