|
Dylan Rickenbacker
Animator
Join date: 11 Oct 2006
Posts: 365
|
02-04-2009 13:22
Hi, I can't get my head around this problem: I have a pair of poseballs that I want to move along a certain path. Currently, I'm doing it like this: if(target == target1) { for(step = 1; step <= 80; step++) { curPos = curPos + <0.0,0.25,0.0>; //curPos has originally been defined as llGetLocalPos() llSetPos(curPos); } llSetPos(target); target = target2; } ... and so on. This works well enough so far, but: I want it to work also when the whole setting in which it takes place is moved to another location, possibly with a different rotation. So I have to make sure that the poseballs are moving along their local y axis, not along the global y axis as they are doing now. Can someone point me in the right direction how to do that? Thanks in advance!
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
02-04-2009 14:13
Sure. Just take the offset from the current position and multiply it by the prim's current rotation. llGetRot() is probably your best bet. What multiplying by the prim's rotation does is translate a vector you've expressed in the prim's local coordinates into one that is expressed in the global coordinate system.
OR, find a vector along the current y-axis and multiply it by the distance you want to move. To find a (unit) vector in the direction of the prim's y-axis, you can use 'llRot2Left(llGetRot())'.
|
|
Dylan Rickenbacker
Animator
Join date: 11 Oct 2006
Posts: 365
|
02-04-2009 23:44
Thanks a lot! I won't pretend to understand why multiplying a vector with a quaternion leads to any meaningful result, but apparently it does. Works like a charm! 
|
|
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
|
02-05-2009 00:03
From: Dylan Rickenbacker Thanks a lot! I won't pretend to understand why multiplying a vector with a quaternion leads to any meaningful result, but apparently it does. Works like a charm!  When I expressed identical bemusement at /54/90/295032/1.html I got some very helpful explanations. And the article at http://wiki.secondlife.com/wiki/Rotation? is one of the more accessible ones in that wiki.
|
|
Harmpie Rhode
Registered User
Join date: 31 Aug 2007
Posts: 3
|
02-15-2009 10:51
wow, I should have known this before  ) haha this makes some things a lot easier
|