• 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-3216
Type: Bug Bug
Status: Resolved Resolved
Resolution: Expected Behavior
Priority: Showstopper Showstopper
Assignee: Unassigned
Reporter: Syn Short
Votes: 0
Watchers: 1
Operations

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

llSetLinkPrimitiveParams(this_link,[PRIM_POSITION,new_position]); does not move child prim

Created: 11/Oct/08 02:32 AM   Updated: 03/Dec/08 12:20 AM
Return to search
Component/s: Scripts
Affects Version/s: None
Fix Version/s: None

Environment: Windows XP, Generic machine.
Issue Links:
Relates
 


 Description  « Hide

//* llSetLinkPrimitiveParams(this_link,[PRIM_POSITION,new_position]); is borken

//-----Demonstrate non-movement of child prim in LinkSet ------------------/
// Object of script is to find position of child, add 5 meters to X-axis,
// store that position, then toggle between the original and original+5m
// positions when child is touched.

//*----- Create two prims, link them, place this script into root,
// get some coffee, then touch the child prim a few times.

list pos_list=[];

integer position=0;

//-----------------------/
default {

//-----------------------/
// get key for child to setup details call
// retrieve position of child into temp list
// retrieve position of child from temp list
// set new position same as original
// add 5 meters to the x axis
// store both positions for later.

state_entry() { key child_key; list details; vector org_pos; vector new_pos; child_key=llGetLinkKey(2); details=llGetObjectDetails(child_key,[OBJECT_POS]); org_pos=llList2Vector(details,0); new_pos=org_pos; new_pos.x+=5.0; pos_list=[org_pos]+[new_pos]; }

//----------------------/
// for each touch
// retrieve the link number touched
// if it was the child then...
// toggle the position list index
// retrieve the new position from storage
// announce the move
// change the child position to that vector

touch_start(integer num) {
integer w;
integer this_link;
vector new_position;

for(w=0; w<num; w++) {
this_link=llDetectedLinkNumber(w);
if (this_link==2) { position=1-position; new_position=llList2Vector(pos_list,position); llSay(0,"Moving to "+(string)new_position); llSetLinkPrimitiveParams(this_link, [PRIM_POSITION,new_position]); }
}

}

}



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Gellan Glenelg added a comment - 11/Oct/08 03:14 AM
When used to set PRIM_POSITION, llSetLinkPrimitiveParams expects a local position, relative to the location of the root prim.

Your example code uses an absolute position.
Say your prim was at <128, 128, 30>... your call to llSetLinkPrimitiveParams is attempting to move the child prim to a position 183m from the root!
This is larger than the distance allowed between linked prims, so the call silently fails.

In your code, change
org_pos=llList2Vector(details,0);
to
org_pos=llList2Vector(details,0) - llGetPos();

If this still fails, your prims may be too small to be linked at the distance specified. Try increasing the size of the prims, or decreasing the value in new_pos.x+=5.0; (see http://wiki.secondlife.com/wiki/Linkability_Rules)


Syn Short added a comment - 11/Oct/08 01:33 PM
Thanks you so much Gellan! I will update the Wiki with this under caveat.

Heron Halberstadt added a comment - 03/Dec/08 12:20 AM
I'm a lousy scripter (or better: no scripter).
I had same problem, and also with set size.
will this fix size as well? or how is it done?