Xiija Posted November 15 Posted November 15 (edited) just wonderin if anyone has a rot lookat thing that doesn't rotate the y axis? in the pic below, you can see the tilt. I'm using this, so far.. vector pos; vector tpos; vector Target; key uuid; default { state_entry() { } touch_start(integer total_number) { uuid = llDetectedKey(0); llSetTimerEvent(0.2); } timer() { list details = llGetObjectDetails(uuid, ([OBJECT_POS])); tpos = llList2Vector( details, 0); pos = llGetPos(); llRotLookAt( llRotBetween( <1.0, 0.0, 0.0>, llVecNorm( tpos - pos ) ) , 1.0, 0.5 ); } } Edited November 15 by Xiija
Quistess Alpha Posted November 16 Posted November 16 (edited) replacing llSLPPF with rotLookAt should be pretty straight-forward: // search llSetLinkPrimitiveParamsFast(0, [ PRIM_ROTATION, (ZERO_ROTATION/rINTRINSIC)*look ]); // replace llRotLookAt((ZERO_ROTATION/rINTRINSIC)*look, 1.0, 0.5); would probably work. Edited November 16 by Quistess Alpha
Xiija Posted November 16 Author Posted November 16 (edited) I'm terrible at rotations, is there any way to just adjust the Y value to zero after the main rotation is done? ... either that or do a basic lookat, then adjust the X value to point to the height of the target? Edited November 16 by Xiija 1
Wulfie Reanimator Posted November 17 Posted November 17 (edited) @Quistess Alpha She wants to do this: (keep the Y-plane horizontal) Also, completely unrelated to everything but I'm super curious, what's this code indentation style from? Edited November 17 by Wulfie Reanimator
Love Zhaoying Posted November 17 Posted November 17 19 minutes ago, Wulfie Reanimator said: Also, completely unrelated to everything but I'm super curious, what's this code indentation style from? I didn't even notice. I favor the old C/C++ style where the "{" is on the same line as the relevant code.
Quistess Alpha Posted November 17 Posted November 17 (edited) 1 hour ago, Wulfie Reanimator said: She wants to do this: (keep the Y-plane horizontal) Which is basically done exactly as you have it in your animation, just you have to calculate the angles manually. The relevant calculation from what I linked to above (with some more comments): // where direction is the vector pointing from the object to the target to look at. rotation look = llAxisAngle2Rot(<0,1,0>, -llAtan2(direction.z,llVecMag(<direction.x,direction.y,0>)) )* // y-axis, angle on the z,x plane. llAxisAngle2Rot(<0,0,1>, llAtan2(direction.y,direction.x) ) ; // z-axis, angle on the x,y plane // rotates on (local==global) z axis and then the local y-axis. (which is the same as global y then global z) A bit annoying that constructing this requires a bit of trig and maybe drawing a few diagrams to understand why it is what it is, but it works (assuming I get what we're looking for) 1 hour ago, Wulfie Reanimator said: Also, completely unrelated to everything but I'm super curious, what's this code indentation style from? from copy-pasting and being too lazy to fix. I agree, not a great indentation, but it didn't seem bad enough to go back and edit the post. Edited November 17 by Quistess Alpha 2
Wulfie Reanimator Posted November 17 Posted November 17 4 minutes ago, Quistess Alpha said: from copy-pasting and being too lazy to fix. I agree, not a great indentation, but it didn't seem bad enough to go back and edit the post. No no, your use of this style is way too consistent to be lazy! For example this long script from a couple months back, but all of your recent code matches. Hopefully @Xiija will be happy with the example you gave, as it does exactly what she wants. 1
Quistess Alpha Posted November 17 Posted November 17 (edited) 16 minutes ago, Wulfie Reanimator said: your use of this style is way too consistent to be lazy! Oh, I usually try for Horstmann especially in forum posts where having needless mostly blank lines makes me feel like I'm taking up too much space. but I'm not religious about it, in that example for instance, the do statement is out of style. ETA: also, In the abstract, I like tabs over spaces, but the in-world editor uses spaces and imports scripts with tabs badly, so, whatever the in-world defaults to for spaces (4 probably) for indent levels. Edited November 17 by Quistess Alpha 1 1
Xiija Posted November 17 Author Posted November 17 (edited) tysm all, seems to work good as for styles, I use Horstmann in SL, and K&R when i code js the finished code ... vector pos; vector tpos; vector direction; key uuid; default { state_entry() { } touch_start(integer total_number) { uuid = llDetectedKey(0); llSetTimerEvent(0.25); } timer() { list details = llGetObjectDetails(uuid, ([OBJECT_POS])); tpos = llList2Vector( details, 0); pos = llGetPos(); direction = tpos - pos; rotation look = llAxisAngle2Rot(<0,1,0>, -llAtan2(direction.z,llVecMag(<direction.x,direction.y,0>)) )* llAxisAngle2Rot(<0,0,1>, llAtan2(direction.y,direction.x) ) ; llSetLinkPrimitiveParamsFast(0, [ PRIM_ROTATION, look ]); } } Edited November 17 by Xiija 1
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now