Rotation problems with llRezAtRoot
|
|
Damien1 Thorne
Registered User
Join date: 26 Aug 2007
Posts: 4,877
|
05-12-2009 18:14
I am using llRezAtRoot to rez a linked item. It consists of six prims (4 hemispheres and 2 wedges). When rezzed the offsets work properly but when rotating it 180 deg. around the z axis, the object stops at 144.7 degrees. I have used 3.141, PI, and 180*DEG_TO_RAD but all stop at the same point. Any one have any ideas? The x and y values are zero.
llRezAtRoot("Island", llGetPos() + <7.502,1.721,1.606>, <0.0,0.0,0.0>, <0.0,0.0,PI,1.0>, 0);
_____________________
As we fade into the darkness...
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-12-2009 21:31
could be two things that I can think of offhand
I don't think rez will let you rec an object that insects the rezzor (I could be wrong)
or perhaps it's using the geometric center of the rezzed object to calculate rez distance (and your rotation would put it outside the limit.)
just wild guess' though
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
05-12-2009 21:51
Is that < 0.0, 0.0, PI, 1> the right way to that?
Should it be llEuler2Rot( < 0, 0, PI> ) ?
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
|
Damien1 Thorne
Registered User
Join date: 26 Aug 2007
Posts: 4,877
|
05-12-2009 22:18
I will play with both suggestions and report what I come up with. Thanks to both of you.
_____________________
As we fade into the darkness...
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-13-2009 00:06
Yeah, you can't just place a straight angle in a quaternion. They don't work that way. For those who are actually interested, if you want to rotate by an angle theta about an axis (unit vector) v, the components of the quaternion should actually be: <v.x*sin(theta/2), v.y*sin(theta/2), v.z*sin(theta/2), cos(theta/2)> More info at http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#From_the_rotations_to_the_quaternions
|
|
Damien1 Thorne
Registered User
Join date: 26 Aug 2007
Posts: 4,877
|
05-13-2009 07:07
The llEuler2Rot( < 0, 0, PI> seemed to work properly. Thanks.
_____________________
As we fade into the darkness...
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-13-2009 10:11
FYI another very useful function (which you'll probably find causes a lot fewer errors than using Euler angles) is llAxisAngle2Rot(). For example, the above desired rotation can be expressed as: llAxisAngle2Rot(<0.0, 0.0, 1.0>, PI) See http://www.lslwiki.net/lslwiki/wakka.php?wakka=llAxisAngle2Rot
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-13-2009 17:53
what range are the values in a quat?
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
|
05-13-2009 18:38
I was not at all sure I was right, and it was just about time for bed, not the best times for thinking about scripting (quaternions no less), and I really like don't like making a fool of myself with suggestions that are stupidly wrong, and I've hardly been logging in lately, much less writing any LSL code, so...
I'm glad the suggestion worked.
It would be real nice if the floating point zeros could just be "0" instead of "0.0'", easier to type and much easier to read. I know it used to be necessary to use the ".0", is that still true?
_____________________
-
So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.
I can be found on the web by searching for "SuezanneC Baskerville", or go to
http://www.google.com/profiles/suezanne
-
http://lindenlab.tribe.net/ created on 11/19/03.
Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard, Robin, and Ryan
-
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-13-2009 19:10
From: SuezanneC Baskerville I was not at all sure I was right, and it was just about time for bed, not the best times for thinking about scripting (quaternions no less), and I really like don't like making a fool of myself with suggestions that are stupidly wrong, and I've hardly been logging in lately, much less writing any LSL code, so...
I'm glad the suggestion worked.
It would be real nice if the floating point zeros could just be "0" instead of "0.0'", easier to type and much easier to read. I know it used to be necessary to use the ".0", is that still true? still true for LSO, I really haven't checked for mono... but probably, since I don't see many optimizations in the mono compiler (although I found one, variables stated but unused on a line seem to be omitted, which makes testing variable byte sizes harder but not impossible.) without a point it compiles to the simplest type known, but I think comparisons between numbers are auto-cast to the needed type (which is good for many usages, but bad for some)
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Damien1 Thorne
Registered User
Join date: 26 Aug 2007
Posts: 4,877
|
05-13-2009 19:34
In order to make it easier on my VERY rusty calculus skills, I used this for an item that had rotations on the x and y axis: llEuler2Rot(<358.1, 357.0, 0.0> * DEG_TO_RAD)
_____________________
As we fade into the darkness...
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
05-13-2009 23:51
From: Void Singer what range are the values in a quat? Zero to one for all components. For any purely rotational quaternion (quaternions DO have other uses, though not really in SL), x^2+y^2+z^2+s^2=1 much like for a unit vector.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
05-14-2009 00:59
so definitely no simple way to just plug in a value
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|