• All submissions to this site are governed by Second Life Project Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.
Issue Details (XML | Word | Printable)

Key: SVC-2608
Type: Bug Bug
Status: Resolved Resolved
Resolution: Duplicate
Priority: Major Major
Assignee: Unassigned
Reporter: Rex Cronon
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
2. Second Life Service - SVC

llSetPrimitiveParams([PRIM_ROTATION, rot]) doesn't work right

Created: 05/Jul/08 07:37 PM   Updated: 14/Aug/08 11:01 AM
Return to search
Component/s: Scripts
Affects Version/s: None
Fix Version/s: None

Environment: my OS, computer, or video card plays no role
Issue Links:
Relates
 


 Description  « Hide
rezz 2 cubes
color facets differently
link them
put the following script in both the root and the linked prim
click once on root to rotate 90*
than click on link multiple times
-------------------------------
//-----------------------------------------------------------------------------------------------------
//Copyright @ 2008 Rex Cronon. All rights reserved.
//-----------------------------------------------------------------------------------------------------
float _angle=0;
float _add=90;

default
{
touch_start(integer total_number)
{
if((llDetectedKey(0)==llGetOwner()))//|| (llDetectedKey(0)==_ck))

{ _angle+=_add; if(_angle>=360) _angle=0; vector _er=<0,0,DEG_TO_RAD*_angle>; llSetPrimitiveParams([PRIM_ROTATION, llEuler2Rot(_er)]); //llSetRot(llEuler2Rot(_er)); //llSetLocalRot(llEuler2Rot(_er)); string s="["+(string)llGetLinkNumber()+"](angle:"+(string)_angle+")\n"; _er=llRot2Euler(llGetRot()); s+="llGetRot("+(string)(_er.z*RAD_TO_DEG)+")\n"; _er=llRot2Euler(llGetLocalRot()); s+="llGetLocalRot("+(string)(_er.z*RAD_TO_DEG)+")\n"; llSetText(s,<1,1,1>,1.0); }

}
}
-------------------------------
It seems that if the root rotation is not zero(and is set to a rotation using a script), then for some angles the the link doesn't rotate. If the root is rotated manually than all rotations take place.

===========================================
ATTENTION(seems the following bug is covered by SVC-93):
I was expecting that the linked prim will rotate relative to the root, since when using this function to set the pos of the link , the position is relative to the root.
===========================================



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Lex Neva added a comment - 06/Jul/08 09:38 AM
I think you've run into the bug I described in SVC-93. You'll find a detailed explanation there of what's going on and how to work around it. If that's what's going on here, mark this one as "closed", resolution "duplicate", and leave a comment on SVC-93. Thanks!

Rex Cronon added a comment - 14/Jul/08 02:14 PM - edited
one of my problems was that if the root is rotated using llSetPrimitiveParams, than when when the link is rotated using the same function, for some angle no rotation takes place. If the root is rotated manually than the rotation works.

Andrew Linden added a comment - 13/Aug/08 05:36 PM
I was having trouble reading the script above, so I modified it to be something easier to visually parse (at least for me). Dunno if it compiles:

//-----------------------------------------------------------------------------------------------------
// SVC-2608 – Pirated and modified version of Rex's copyrighted script above
//-----------------------------------------------------------------------------------------------------
float angle = 0;
float delta_angle = 90;

default
{
touch_start(integer total_number)

{ // compute the angle and rotate the object angle += delta_angle; if(angle >= 360) angle = angle - 360; vector euler_angles = <0, 0, DEG_TO_RAD * angle>; llSetPrimitiveParams([PRIM_ROTATION, llEuler2Rot(euler_angles)]); // build the info string vector world_euler_angles = llRot2Euler(llGetRot()); vector local_euler_angles = llRot2Euler(llGetLocalRot()); string text = "[" + (string)llGetLinkNumber() + "](angle:" + (string)angle + ")\n"; text += "llGetRot(" + (string)(world_euler_angles.z * RAD_TO_DEG) + ")\n"; text += "llGetLocalRot(" + (string)(local_euler_angles.z * RAD_TO_DEG) + ")\n"; llSetText(text, <1,1,1>, 1.0); }

}


Lex Neva added a comment - 13/Aug/08 05:50 PM
Andrew, if you're looking for a better description of the bug, check SVC-93.

Andrew Linden added a comment - 14/Aug/08 10:32 AM
Yes, this is a duplicate of SVC-93.