sunil Treves Posted June 22 Share Posted June 22 Hi All, I'm trying to figure out a script that turns/rotate every child prims x axis to points towards the root prim. Ay suggestion/insight would be helpful. Link to comment Share on other sites More sharing options...
Quistess Alpha Posted June 23 Share Posted June 23 default { state_entry() { integer link = llGetNumberOfPrims(); do{ vector X = -llVecNorm(llList2Vector(llGetLinkPrimitiveParams(link,[PRIM_POS_LOCAL]),0)); vector Y = llVecNorm(<0,0,1>%X); vector Z = llVecNorm(X%Y); llSetLinkPrimitiveParamsFast(link,[PRIM_ROT_LOCAL,llAxes2Rot(X,Y,Z)]); }while(--link>1); } } note to self: vecNorms are actually required for accurate results. 1 2 Link to comment Share on other sites More sharing options...
sunil Treves Posted June 23 Author Share Posted June 23 Thanks, it worked like a charm. Link to comment Share on other sites More sharing options...
sunil Treves Posted Thursday at 06:46 PM Author Share Posted Thursday at 06:46 PM That information was very helpful. Is it also possible for linked prims to face towards its adjust / next linked prim same on X axis and not the root prim? Link to comment Share on other sites More sharing options...
Quistess Alpha Posted Thursday at 07:59 PM Share Posted Thursday at 07:59 PM 1 hour ago, sunil Treves said: That information was very helpful. Is it also possible for linked prims to face towards its adjust / next linked prim same on X axis and not the root prim? You can make each linked prim's x-axis face any which way you like, you just need to set X to a normalized vector indicating the direction (in local coordinates). Conveniently for the above example, the local position of a linked prim is a vector pointing from the root to the prim. A vector pointing from one linked prim to another would be the difference in their positions. Link to comment Share on other sites More sharing options...
sunil Treves Posted Friday at 04:20 AM Author Share Posted Friday at 04:20 AM Thanks, Its bit confusing in terms of maths, may i have an code example? Suppose there are 5 linked prims in a zig zag line formation and they need to point at previous link number. thanks in advance Link to comment Share on other sites More sharing options...
Quistess Alpha Posted Friday at 04:31 AM Share Posted Friday at 04:31 AM 2 minutes ago, sunil Treves said: may i have an code example? This (section of the) forum is more for discussing general ideas and methodologies for how to do things, not for asking people to write a complete script for you. I feel a bit crass saying this, but you really ought to learn to script it yourself, or pay someone else to do it for you (for which you might try the 'wanted' or 'in-world employment' sub-sections of the forum). Link to comment Share on other sites More sharing options...
sunil Treves Posted Friday at 04:53 AM Author Share Posted Friday at 04:53 AM (edited) Thanks Apologies if i didn’t explain myself clearly as i didn’t request a complete script but an example for the maths you stated for the difference between there positions. Even a wiki page would do however I can search myself based on ur suggestion. Also, I’m trying to learn the complex system around rotation and been looking for correct direction using this form 9 hours ago, Quistess Alpha said: You can make each linked prim's x-axis face any which way you like, you just need to set X to a normalized vector indicating the direction (in local coordinates). Conveniently for the above example, the local position of a linked prim is a vector pointing from the root to the prim. A vector pointing from one linked prim to another would be the difference in their positions. Have a good day ahead. Edited Friday at 05:30 AM by sunil Treves Link to comment Share on other sites More sharing options...
Quistess Alpha Posted Friday at 05:29 AM Share Posted Friday at 05:29 AM (edited) 41 minutes ago, sunil Treves said: Even a wiki page would do. llGetLinkPrimitiveParams PRIM_POS_LOCAL vector posA = llList2Vector(llGetLinkPrimitiveParams(linkA,[PRIM_POS_LOCAL]),0); vector posB = llList2Vector(llGetLinkPrimitiveParams(linkB,[PRIM_POS_LOCAL]),0); vector difference = posA-posB; The difference between 2 things isn't exactly rocket science? ETA: while I'm posting wiki links: https://en.wikipedia.org/wiki/Cross_product More usefully, crossing 2 of these axes in counter-clockwise order gives you the third: Thumb%pointer=middle; pointer%middle=thumb; middle%thumb=pointer Edited Friday at 05:39 AM by Quistess Alpha 1 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now