I'm trying to make a wheelchair. It will attach to the wearer, and contains a pose that seats the user correctly. What I would also like to do is have the wheels rotate correctly as it moves. I'm using an animated texture to mimic movement rather than rotating the actual prims. So far, I can get them to rotate forwards and backwards when the user presses his up and down arrow keys, and rotate in opposite directions to turn the chair when the left or right arrow keys are pressed. However, I would also like to programme slightly different behaviour when both the up arrow and one of the left or right arrows are pressed together, and it's this I am struggling with.
Here's an extract from the script I've got so far:
control(key id, integer level, integer edge)
{
if (level & CONTROL_FWD)
{
if (edge & CONTROL_FWD)
{
llSetLinkTextureAnim(2, ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES, 1,1,0, TWO_PI, -TWO_PI);
llSetLinkTextureAnim(3, ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES, 1,1,0, TWO_PI, TWO_PI);
llSetLinkTextureAnim(4, ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES, 1,1,0, TWO_PI, TWO_PI);
llSetLinkTextureAnim(5, ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES, 1,1,0, TWO_PI, -TWO_PI);
}
else
{
llSetLinkTextureAnim(2, ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES, 1,1,0, TWO_PI, -TWO_PI);
llSetLinkTextureAnim(3, ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES, 1,1,0, TWO_PI, TWO_PI);
llSetLinkTextureAnim(4, ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES, 1,1,0, TWO_PI, TWO_PI);
llSetLinkTextureAnim(5, ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES, 1,1,0, TWO_PI, -TWO_PI);
}
}
else
{
if (edge & CONTROL_FWD)
{
llSetLinkTextureAnim(LINK_SET, FALSE, ALL_SIDES, 0, 0, 0.0, 0.0, 1.0);
}
}
This works correctly. The texture starts to rotate when the Up arrow is pressed, and stops when it's released. How would I modify it (to start with) to do exactly the same when (say) the Up and Left arrows were held down at the same time.
Thanks in advance for any help you can offer.