childhoodbestfriend489 Posted March 24, 2021 Share Posted March 24, 2021 After attaching object isn't asking permission: integer prm; default { attach(key id) { if (id) { llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS); } } run_time_permissions(integer perm) { if (perm) { prm = TRUE; llTakeControls(CONTROL_UP|CONTROL_DOWN, TRUE, FALSE); } } control(key id, integer level, integer edge) { if (prm == TRUE) { if (CONTROL_UP) { llMoveToTarget(llGetPos()+<0,0,1>,10); } } } } Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted March 24, 2021 Share Posted March 24, 2021 (edited) http://wiki.secondlife.com/wiki/LlRequestPermissions PERMISSION_TAKE_CONTROLS is granted automatically while the script is attached to the target avatar, or if the target avatar is sitting on the script. Edited March 24, 2021 by Wulfie Reanimator Link to comment Share on other sites More sharing options...
childhoodbestfriend489 Posted March 24, 2021 Author Share Posted March 24, 2021 What's the gravity of secondlife? Link to comment Share on other sites More sharing options...
childhoodbestfriend489 Posted March 24, 2021 Author Share Posted March 24, 2021 Whatever I do, go up, want to go to all directions integer prm; default { attach(key id) { if (id) { llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS); } } run_time_permissions(integer perm) { if (perm) { prm = TRUE; llTakeControls(CONTROL_UP|CONTROL_DOWN|CONTROL_FWD|CONTROL_BACK, TRUE, FALSE); } } control(key id, integer level, integer edge) { if (prm==TRUE) { if (CONTROL_UP) { llSetStatus(STATUS_PHYSICS, TRUE); llMoveToTarget(llGetPos()+<0,0,1>,.1); } else if (CONTROL_DOWN) { llSetStatus(STATUS_PHYSICS, TRUE); llMoveToTarget(llGetPos()-<0,0,1>,.1); } else if (CONTROL_FWD) { llSetStatus(STATUS_PHYSICS, TRUE); llMoveToTarget(llGetPos()+<0,1,0>,.1); } else if (CONTROL_BACK) { llSetStatus(STATUS_PHYSICS, TRUE); llMoveToTarget(llGetPos()-<0,1,0>,.1); } } } } Link to comment Share on other sites More sharing options...
redpurple Carpaccio Posted March 24, 2021 Share Posted March 24, 2021 (edited) 2 hours ago, childhoodbestfriend489 said: Whatever I do, go up, want to go to all directions control(key id, integer level, integer edge) { if (prm==TRUE) { if (CONTROL_UP) { llSetStatus(STATUS_PHYSICS, TRUE); llMoveToTarget(llGetPos()+<0,0,1>,.1); } And it s normal , because in this piece of code , CONTROL_UP has always the value True . The test if ( CONTROL_UP) is not what you expect to do really In fact you need to check the variables in parameters of the event ( named level and edge , in your case ) For instance by ( but it may depend of other comportments you desire about your HUD , sometimes you will need to check a combination of the variables level and edge , sometimes only the variable level , etc .. ) : if ( level & CONTROL_UP) ... else if ( level & CONTROL_DOWN) ... else if ( level & CONTROL_RIGHT) ... etc ... OR BY : if ( edge & CONTROL_UP) ... else if ( edge & CONTROL_DOWN) ... else etc ... In addition , yourscript , in its actual version , spamming "llSetStatus(STATUS_PHYSICS, TRUE);" ( you may around 40 events per seconds , if you let the key pressed , so , it s costly to set physics 40 times per seconds ) It should be avoided , in setting physics on , only one time For your information : • integer level – bitfield of CONTROL_* flags, non-zero while one or more keys is being held down. • integer edge – bitfield of CONTROL_* flags, non-zero when one or more keys have been just pressed or released. Edited March 24, 2021 by redpurple Carpaccio Link to comment Share on other sites More sharing options...
childhoodbestfriend489 Posted March 24, 2021 Author Share Posted March 24, 2021 How to move forward to the avatar's front? Link to comment Share on other sites More sharing options...
Profaitchikenz Haiku Posted March 24, 2021 Share Posted March 24, 2021 Use Control_up and control_down for the forwards and backwards movements, use Page_up and page_down for verticals Link to comment Share on other sites More sharing options...
childhoodbestfriend489 Posted March 24, 2021 Author Share Posted March 24, 2021 I mean, not derectly, using that script, when I am not on ground. Link to comment Share on other sites More sharing options...
redpurple Carpaccio Posted March 24, 2021 Share Posted March 24, 2021 (edited) 1 hour ago, childhoodbestfriend489 said: How to move forward to the avatar's front? You need to use a vector with the Y and Z value to zero; for instance <1,0,0> and you multiply it by the rotation of the avatar , so , for instance <1,0,0> * llGetRot() for an object attached integer prm; move(vector v) { llMoveToTarget(llGetPos()+v*llGetRot(),.1); } default { state_entry() { llRequestPermissions(llGetOwner(),PERMISSION_TAKE_CONTROLS); } attach(key id) { if (id) { llRequestPermissions(id,PERMISSION_TAKE_CONTROLS); } else { llSetStatus(STATUS_PHYSICS, FALSE); } } run_time_permissions(integer perm) { if (perm) { prm = TRUE; llTakeControls(CONTROL_UP|CONTROL_DOWN|CONTROL_FWD|CONTROL_BACK, TRUE, FALSE); llSetStatus(STATUS_PHYSICS, TRUE); } } control(key id, integer level, integer edge) { if ( level & CONTROL_UP) { move( <0,0,1.0 >); } else if ( level & CONTROL_DOWN) { move( <0,0,-1.0 >); } else if ( level & CONTROL_FWD) { move( <1.0, 0, 0 >); } else if ( level & CONTROL_BACK) { move( <-1.0, 0, 0 >); } } } Edited March 24, 2021 by redpurple Carpaccio Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted March 24, 2021 Share Posted March 24, 2021 (edited) 1 hour ago, Profaitchikenz Haiku said: Use Control_up and control_down for the forwards and backwards movements, use Page_up and page_down for verticals CONTROL_FWD and CONTROL_BACK for forwards and backwards. (W/ArrowUp and S/ArrowDown) CONTROL_UP and CONTROL_DOWN for vertical up and down. (E/PageUp and C/PageDown) Edited March 24, 2021 by Wulfie Reanimator 1 Link to comment Share on other sites More sharing options...
Profaitchikenz Haiku Posted March 24, 2021 Share Posted March 24, 2021 I really should engage you as my proof-reader, shouldn''t I? 2 Link to comment Share on other sites More sharing options...
Wulfie Reanimator Posted March 24, 2021 Share Posted March 24, 2021 (edited) 14 minutes ago, Profaitchikenz Haiku said: I really should engage you as my proof-reader, shouldn''t I? I work for free! P.S. You had an extra apostrophe there. Edited March 24, 2021 by Wulfie Reanimator Link to comment Share on other sites More sharing options...
Profaitchikenz Haiku Posted March 24, 2021 Share Posted March 24, 2021 1 minute ago, Wulfie Reanimator said: You had an extra apostrophe there. The Raspberry Pi 400 keyboard is hampering my already-bad typing by mostly missing out letters, and on the odd occasion, repeating them. I'm going to try spilling coffee on and dropping crumbs into it to try and get it into my normal keyboard state. 1 Link to comment Share on other sites More sharing options...
childhoodbestfriend489 Posted March 25, 2021 Author Share Posted March 25, 2021 Need an example page link for move <...> @ redpurple Carpaccio Link to comment Share on other sites More sharing options...
Mollymews Posted March 25, 2021 Share Posted March 25, 2021 15 minutes ago, childhoodbestfriend489 said: Need an example page link for move <...> from what you have posted it seems that you want an impulse engine, that applies impulse/movement to the agent when the keyboard controls are pressed the most complete agent impulse engine source code is Flight Feather by Argent Stonecutter, which can be obtained from his store here: Link to comment Share on other sites More sharing options...
redpurple Carpaccio Posted March 25, 2021 Share Posted March 25, 2021 3 hours ago, childhoodbestfriend489 said: Need an example page link for move <...> @ redpurple Carpaccio I m not sure to understand : i have modified your script in my last answer . put it in the root prim of an HUD . So what do you expect ? Link to comment Share on other sites More sharing options...
childhoodbestfriend489 Posted March 25, 2021 Author Share Posted March 25, 2021 (edited) @redpurple Carpaccio Couldn't understand you reply at that time. Now it's clear and working, thanks. Edited March 25, 2021 by childhoodbestfriend489 Link to comment Share on other sites More sharing options...
childhoodbestfriend489 Posted March 25, 2021 Author Share Posted March 25, 2021 (edited) @redpurple Carpaccio But you used v*llGetRot() instead v+llRot2Euler(llGetRot()), Why? Edited March 25, 2021 by childhoodbestfriend489 Link to comment Share on other sites More sharing options...
Profaitchikenz Haiku Posted March 25, 2021 Share Posted March 25, 2021 (edited) Short answer is have a look at the wiki ages for rotation for use of * and / when applying rotations; to rotate a vector we multiply it by a rotation, adding vector to vector just performs a translation. Long answer, the same as the short answer, but additionally and in particular as recently described by MollyMews, quarternions get it right where eulers get it wrong in certain cases. (I'm going to get hammered over this, I'm building myself a fallout shelter and going into it until it seems safe again). Edited March 25, 2021 by Profaitchikenz Haiku Link to comment Share on other sites More sharing options...
redpurple Carpaccio Posted March 25, 2021 Share Posted March 25, 2021 (edited) 3 hours ago, childhoodbestfriend489 said: @redpurple Carpaccio But you used v*llGetRot() instead v+llRot2Euler(llGetRot()), Why? I use llGetPos()+v*llGetRot() because llMoveToTarget uses region coordinates . The vector v <1,0,0> is in local coordinates linked in the frame of reference of avatar : it means "front of avatar" , but of course , in region coordinates , v can t have <1,0,0> as value . So i need to convert it in the frame of refrence of the region . it s exactly what does a multiplication of a vector by a quaternion LLRot2Euler gives the axis of rotation . So , it s wrong . For instance let s guess v was <100, 0,0> . Let s guess a rotation of PI/4 By evidence , the vector V converted , should get the same length ( same magnitude ) V * llGetRot() gives again a vector with 100 of magnitude . For instance , magnitude ( 100 / root(2) = 70.71 , 100/ root(2) = 70.71 , 0 ) = 100 Your formula will give a vector between <100 , 0 ,-1 > and <100, 0,1> and won't give a constant magnitude of 100 and doesn t turn with the angle of rotation. Your formula is false in this case An another point who should convince you that llRot2Eurler shouldn t be used for this case . LlRot2Euler gives the axis of rotation from a quaternion . But the rotation for an avatar has always its axis along the Z coordinates . So when you add v+llRot2Euler(llGetRot()) you don t change the X and Y coordinates Edited March 25, 2021 by redpurple Carpaccio Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now