Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

object axis face same dirrect as avatar?

Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
12-30-2007 12:29
im working on something and im completly lost, this sensor by default will look at anything your avatar is looking at in mouse look, the probem im having is i cant get the east side of the object to face east when im looking that way, hard to exsplain what i mean but im trying to make the sensor work with tcs witch only works on the X axis of the object i belive, here is the sensor script im using

CODE

key gunnerId = NULL_KEY;

default
{
state_entry()
{
llSetLocalRot(<0.00000, 0.70711, 0.00000, 0.70711>);
}

link_message(integer sender_num, integer num, string str, key id)
{
if (str == "gunner1")
{
gunnerId = id;
if (id == NULL_KEY)
{
llSensorRemove();
llSetLocalRot(<0.00000, 0.70711, 0.00000, 0.70711>);
}
else
{
llSensorRepeat("", gunnerId, AGENT, 10.0, TWO_PI, 0.01);
}
}
}

no_sensor()
{
gunnerId = NULL_KEY;
llSensorRemove();
llSetLocalRot(<0.00000, 0.70711, 0.00000, 0.70711>);
}

sensor(integer num_detected)
{
if (gunnerId == NULL_KEY)
{
llSensorRemove();
llSetLocalRot(<0.00000, 0.70711, 0.00000, 0.70711>);
}
else
{
llEuler2Rot(<headRot.y, 0.0, headRot.z>);
llSetRot(<0.00000, 0.70711, 0.00000, 0.70711> * ((llDetectedRot(0) / llGetRootRotation()) / llGetRootRotation()));
}
}
}
Mrc Homewood
Mentor of Randomness
Join date: 24 Feb 2007
Posts: 779
12-30-2007 13:07
<problem fixed>

forgot about my drafting skills same tyoe of mesurements >.>