Daniells Brandi Posted November 30, 2013 Share Posted November 30, 2013 hello guys, I need help with this script, make the rotation happens smoothly. (with steps) vector r_open = <170.0, 76.0, 143.0>; vector r_close = <0.0, 90.0, 90.0>; rotation LocalRot(rotation localrot) { rotation LocRot = localrot / ( (ZERO_ROTATION / llGetLocalRot()) * llGetRot()); return LocRot; } OPEN() { llSetPrimitiveParams([PRIM_ROTATION, LocalRot(llEuler2Rot(r_open * DEG_TO_RAD))]); } CLOSE() { llSetPrimitiveParams([PRIM_ROTATION, LocalRot(llEuler2Rot(r_close* DEG_TO_RAD))]); } thanks! Link to comment Share on other sites More sharing options...
LepreKhaun Posted November 30, 2013 Share Posted November 30, 2013 Look into https://wiki.secondlife.com/wiki/LlSetKeyframedMotion. Link to comment Share on other sites More sharing options...
Daniells Brandi Posted November 30, 2013 Author Share Posted November 30, 2013 thank for help LepreLhaun but it works in vehicle? Link to comment Share on other sites More sharing options...
steph Arnott Posted November 30, 2013 Share Posted November 30, 2013 From the wiki, may help. // Smooth Door Script - Version 1.2// by Toy Wylie// Distributed under the following licence:// - You can use it in your own works// - You can sell it with your work// - This script must remain full permissions// - This header notice must remain intact// - You may modify this script as needed float openingTime=3.0; // in secondsfloat openingAngle=90.0; // in degreesfloat autocloseTime=15.0; // in secondsinteger steps=4; // number of internal rotation stepsinteger world=TRUE; // align to world or root prim rotation string soundOpen="door_open";string soundClose="door_close"; float omega=0.0; vector axis;rotation closedRot;rotation openRot; integer swinging;integer open; sound(string name){ if(llGetInventoryType(name)==INVENTORY_SOUND) llTriggerSound(name,1.0);} openDoor(integer yes){ if(yes) sound(soundOpen); vector useAxis=axis; open=yes; if(!yes) useAxis=-axis; llSetTimerEvent(openingTime/(float) steps); llTargetOmega(useAxis,omega,1.0);} go(){ if(swinging==0) { if(!open) { axis=<0.0,0.0,1.0>/llGetRootRotation(); closedRot=llGetLocalRot(); if(world) openRot=llGetRot()*llEuler2Rot(<0.0,0.0,openingAngle>*DEG_TO_RAD)/llGetRootRotation(); else openRot=closedRot*llEuler2Rot(<0.0,0.0,openingAngle>*DEG_TO_RAD); } swinging=steps; openDoor(!open); }} rotation slerp(rotation source,rotation target,float amount){ return llAxisAngle2Rot(llRot2Axis(target/=source),amount*llRot2Angle(target))*source;} default{ state_entry() { swinging=0; open=FALSE; omega=TWO_PI/360*openingAngle/openingTime; llTargetOmega(ZERO_VECTOR,1.0,1.0); } touch_start(integer dummy) { go(); } collision_start(integer dummy) { go(); } timer() { if(swinging>0) { swinging--; if(swinging!=0) { float amount=(float) swinging/(float) steps; if(open) amount=1.0-amount; llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,slerp(closedRot,openRot,amount)]); return; } llTargetOmega(axis,0.0,0.0); if(open) { llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,openRot]); llSetTimerEvent(autocloseTime); } else { llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROT_LOCAL,closedRot]); sound(soundClose); llSetTimerEvent(0.0); } } else // autoclose time reached { llSetTimerEvent(0.0); openDoor(!open); swinging=steps; } }} Link to comment Share on other sites More sharing options...
Daniells Brandi Posted November 30, 2013 Author Share Posted November 30, 2013 I could not do the same rotation that posted in the first post with this script. the object always rotate on only 1 axis Link to comment Share on other sites More sharing options...
LepreKhaun Posted November 30, 2013 Share Posted November 30, 2013 One must always abide by any usage restrictions given in the header information of scripts, Steph. Otherwise you're ignoring the license granted by the author of the code. https://wiki.secondlife.com/wiki/Smooth_Rotating_Door {ETA what you failed to include in your copy and paste with my own emphasis added] // Smooth Door Script - Version 1.2// by Toy Wylie// Distributed under the following licence:// - You can use it in your own works// - You can sell it with your work// - This script must remain full permissions// - This header notice must remain intact// - You may modify this script as needed Link to comment Share on other sites More sharing options...
steph Arnott Posted November 30, 2013 Share Posted November 30, 2013 Sorry, never really thought about it to be honest. ADDED: It correct now. Link to comment Share on other sites More sharing options...
Daniells Brandi Posted November 30, 2013 Author Share Posted November 30, 2013 I could not do the same rotation that posted in the first post with this script. the object always rotate on only 1 axis Link to comment Share on other sites More sharing options...
LepreKhaun Posted November 30, 2013 Share Posted November 30, 2013 I understand, no problem. My personal preference is to always link to the wiki from the forums, just to get people to go there. I feel if I copy & pasted from there to here, they'd miss out on getting to where all of their answers really are. 1 Link to comment Share on other sites More sharing options...
steph Arnott Posted November 30, 2013 Share Posted November 30, 2013 Well, you have too set the other variables. Link to comment Share on other sites More sharing options...
Daniells Brandi Posted November 30, 2013 Author Share Posted November 30, 2013 You can help me? I'm new to this script and the rotation is very difficult ( Link to comment Share on other sites More sharing options...
steph Arnott Posted December 1, 2013 Share Posted December 1, 2013 I feel I neither have the skill or confidence to teach anyone. The wiki is your best learning guide. Teaching is an unforgiving task and far beyond my simple capabilities. 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