Jump to content

Move/rotation


Phil Deakins
 Share

You are about to reply to a thread that has been inactive for 2391 days.

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

Recommended Posts

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()

  • Like 1
Link to comment
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).

 

Link to comment
Share on other sites

Glad to hear it.  :)

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.  

Link to comment
Share on other sites

If you haven't already, read this page, too...

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

And ignore the math on this page, just read the history...

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.

Link to comment
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.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2391 days.

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...