Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

My wingbones broke and now they're sideways. o.@

Charmande Petion
Registered User
Join date: 4 Jan 2006
Posts: 118
06-14-2006 13:57
Ehh...

I wrote zee little script...

vector spread = <0,0,PI_BY_TWO>;
rotation newRotters;

default
{
state_entry()
{
llSay(0, "Hello, Avatar!";);
}

touch_start(integer total_number)
{
rotation uglySpread = llEuler2Rot(spread);
newRotters = uglySpread * llGetRot();
llSetRot(newRotters);

llSay(0, "Touched.";);
}
}

... it spins zee object 90 degrees every time it is clicked, and it works fine!

But when I attach the object... it only rotates the first time... and refuses to rotate upon further clicks!

Have what I done wroong? *cry*
Charmande Petion
Registered User
Join date: 4 Jan 2006
Posts: 118
06-14-2006 14:23
Wait wait... I think I figured part of it out while I was eating some Chicken Noodle-O's just now. Also, I sorta burnt my tongue on them, they were hot! >.<

...the direction that my object rotates seems to be dependent on which direction my avatar is facing. o.o

...that's all I figured out. >.>
Terrin Keegan
Registered User
Join date: 15 Aug 2004
Posts: 4
06-15-2006 10:31
Well you figured out the main problem.

llGetRot() called in an attachment returns the rotation of your avatar (where you're actually facing in game) not the actual attachment's rotation. But llSetRot() will set the rotation of your attachment in relation to your avatar (or the attachment point actually).

If you want the script to change your attachment rotation per click you need to detect the rotation of the attachment and add your rotation to that. You do this with llGetLocalRot() and llSetRot(). Try the following in place of your touch_start event.

CODE

touch_start(integer total_number) {
rotation uglySpread = llEuler2Rot(spread);
newRotters = uglySpread * llGetLocalRot();
llSetRot(newRotters);

llSay(0, "Touched.");
}


Also make sure this script of yours is in the parent prim of your object. If it shows in the object's contents when you select the whole thing you should be okay. If not it'll probably not work properly.