The Journey Begins

move_to_pos(integer to) {
  vector target = get_vec(to);
  llSetPos(target);
}

And get_vec evolved into this, though I wrote it inline to begin with:

vector get_vec(integer i ) {
  return llList2Vector(adjusted, get_index(i));
}

integer get_index(integer i) {
  integer N = llGetListLength(adjusted);
  integer fetch = 2*i;
  if (fetch < 0 ) fetch += N;
  fetch = fetch%N;
  return fetch;
}

The key insight here, and it took me a while to see it, is that the roll angle we want is the angle between the two rods in that picture. To rotate to that angle, we want the rotation between those two rods. If the given normal in the input data is in the variable norm, then we want llRotBetween(,norm). Why? Because the y-face normal of the transparent cube is “, because it sticks straight out in the Y direction.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by WordPress.com.

Up ↑