Grid Strom
Registered User
Join date: 4 Jul 2008
Posts: 1
|
08-28-2009 01:45
Hi i have been trying to script missile turret to use both mouse look ROT and lookat pos i have a question about the two
Why does llRotLookAt have a different forward axis to llLookAt they are about PI/4 difference
only when i try to add * <0,0,PI/4,0> there is no change in the rotation at all
Has any one come across this problem before and has found the correct rotation formula?
this is what i currently have
rotation campos; default { state_entry() { llRequestPermissions( llGetOwner(), PERMISSION_TRACK_CAMERA ); } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) {
} } timer() { campos = llGetCameraRot(); // * <0,0,PI/4,0> <--- maybe im missing some thing llRotLookAt( campos , 2.0, 1.0 );
}
touch_start(integer total_number) { llSetTimerEvent(0.1); } }
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
08-28-2009 02:09
From: Grid Strom Why does llRotLookAt have a different forward axis to llLookAt they are about PI/4 difference llLookAt has the Z-axis as forward, llRotLooAt has the X-axis. It won't help to ask why, that is the way it is  To overcome that and to change to what you want as forward, you add a constant rotation the way you describe. So you provided the solution. Besides: using an angle in a quaternion is WRONG! http://www.lslwiki.net/lslwiki/wakka.php?wakka=quaternions
_____________________
From Studio Dora
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
08-28-2009 07:22
llLookAt takes a vector, and uses a default of "up" or < 0.0,0.0,1.0 > to rotate "from". llRotLookAt takes a rotation, which works like all other rotation functions. The rotation engine treats all rotations with X-axis as forward. The difference between the two isn't PI/4.0, it is PI/2.0 (90 degrees), but that is only true based on axis separation. If the root prim of what you are rotating isn't "pointing" in the positive X-axis direction at ZERO_ROTATION, then you have to calculate the difference and include it as a constant rotation. ie: rotation rot_diff = llEuler2Rot(<0.0,PI/4.0,0.0>  ; // or whatever the difference in rotation is llRotLookAt( llGetCameraRot() / rot_diff, 2.0, 1.0);
|