# Move/rotation

Please take a moment to consider if this thread is worth bumping.

## Recommended Posts

I'm back again with another rotation problem. Rotations always seem to flummox me.

I want to move a prim (it's actually the root of a linked set) in the direction it's facing, whatever it's rotation in the region is. Any help would be greatly appreciated.

##### Share on other sites

Just fix the rotation in a global parameter. Then you could use a test if for what ever reason if it has changed and snap it back.

##### Share on other sites

The local direction that a prim is facing is always llGetRot(), and "forward" is in the prim's +X direction, so if you want to move a prim in the direction that it's facing, you will want to move it to

llGetPos() + <forward_distance,0.0,0.0>* llGetRot()

• 1
##### Share on other sites

Thank you Rolig. I'll give that a whirl.

I did try a test using *llGetRot() but I obviously did it wrong. I have a mental block with rotations in SL.

##### Share on other sites

The multiplication sign is a bit misleading here, since you're not multiplying the vector by anything.   You're translating it.

The reason this can be a source of confusion is that multiplication is commutative; that is, a*b == b*a.

Translations, on the other hand, certainly aren't commutative, and llSetPos(pos * llGetRot()) means something very different from llSetPos (llGetRot() * pos).

##### Share on other sites

It doesn't take much to confuse the hell out of me

@Rolig. That worked - ty

##### Share on other sites

Yeah, you have stepped into an area of math that is really not all that difficult, but it's often neglected in the standard curriculum.  I've never understood why. Matrix algebra is extremely useful as a way to manage geometric manipulations in numerical terms. It has only a handful of fundamental rules. Once you've mastered them, a lot of the mystery of vectors and rotations in SL becomes much clearer.  (It never vanishes, but it does make sense.)  If you're at all interested -- not just frustrated but actually interested enough to figure it out -- I think you'll find it easy to get a basic primer in any good book store.

##### Share on other sites

"small pebble used for counting" lol

##### Share on other sites

Right. I have that page open and I'll go through it during today. If I don't mange to get a grasp of it today, I'll bookmark it. Thank you, Rolig. You're my hero As is Innula, of course

##### Share on other sites

http://wiki.secondlife.com/wiki/Rotation

https://en.wikipedia.org/wiki/Quaternion

I like that Hamilton carved his quaternion equation into a stone bridge on his way to a meeting. I'm the sort who often misses meetings and leaves barely enough time to get to those I remember, let alone carve things in stone along the way.

##### Share on other sites

That's why rotations always flummox me. Vectors are straight forward but quaternions are not - not to me, anyway. And there's so much reading that I won't go away any the wiser - except that * doesn't multiply. I hadn't known that before. No wonder it always flummoxed me. I had read the LL stuff about rotations and quaternions, but not to the extent of actually understanding it.