I am working on an object that rotates when called from another prim. Its a wheel for a vehicle. If the vehicle isnt in motion then the wheels turning looks silly so justa roation script isn't enough. I want it to spin when forward and backward directional keys are called.
The example I am using is a texture alpha script modified with the "setalpha" line replaced with "targetOmega" lines. from the vehicle controls I am calling llSay( channel, "whatever"
; to call out the command from the directional controls. its the same command announced in the toggle script from the alpha example.in theory I thought this would work but the prim doesnt spin when called. To test this I set up the alpha toggle scripts with the target omega functions to see if it would work without being called from the vehicle script ( in other words I set up two linked prims one with the on/off script and one with the toggle switch script). It still does not spin.
So I am curious if I am not calling this correctly or if target omega perhaps doesnt work in this manner?
below are the modified setalpha scripts:
CODE
init()
{
llListen(1066, "", "", "");
llTargetOmega(<0,0,0>,PI,1.0);
}
SPIN()
{
llTargetOmega(<0,1,0>,PI,1.0);
}
NOSPIN()
{
llTargetOmega(<0,0,0>,PI,1.0);
}
default
{
state_entry()
{
init();
}
on_rez(integer start_param)
{
init();
}
attach(key attached)
{
init();
}
listen(integer chan, string name, key id, string msg)
{
if(llGetOwnerKey(id) == llGetOwner())
{
if(llToLower(msg) == "NOSPIN")
{
NOSPIN();
}
if(llToLower(msg) == "SPIN")
{
SPIN();
}
}
}
}
and the toggle switch
CODE
integer SPIN = 1;
default {
touch_start(integer n) {
if(SPIN)
llSay(1066, "SPIN");
else
llSay(1066, "NOSPIN");
SPIN = !SPIN;
}
}
Thanks for any advice you can offer.