movelikeashark.lslp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // The line above should be left blank to avoid script errors in OpenSim.
  3. /*
  4. * Part of the Sloodle project (www.sloodle.org)
  5. * movelikeashark.lsl
  6. *
  7. * Copyright (c) 2011-06 contributors (see below)
  8. * Released under the GNU GPL v3
  9. * -------------------------------------------
  10. *
  11. * This program is free software: you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation, either version 3 of the License, or
  14. * (at your option) any later version.
  15. *
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  23. *
  24. * All scripts must maintain this copyrite information, including the contributer information listed
  25. *
  26. * As mentioned, this script has been licensed under GPL 3.0
  27. * Basically, that means, you are free to use the script, commercially etc, but if you include
  28. * it in your objects, you must make the source viewable to the person you are distributuing it to -
  29. * ie: it can not be closed source - GPL 3.0 means - you must make it open!
  30. * This is so that others can modify it and contribute back to the community.
  31. * The SLOODLE github can be found here: https://github.com/sloodle
  32. *
  33. * Enjoy!
  34. *
  35. * Contributors:
  36. * Paul Preibisch
  37. * Edmund Edgar
  38. *
  39. * DESCRIPTION
  40. * makes the object's movements look like a fish
  41. */
  42. vector degrees_of_swish = < 0.0, 0.0, 10.0 >;
  43. vector degrees_of_antiswish = < 0.0, 0.0, -10.0 >;
  44. rotation quat_of_swish;
  45. rotation quat_of_antiswish;
  46. integer side = 0;
  47. default
  48. {
  49. state_entry()
  50. {
  51. degrees_of_swish *= DEG_TO_RAD;
  52. degrees_of_antiswish *= DEG_TO_RAD;
  53. quat_of_swish = llEuler2Rot( degrees_of_swish );
  54. quat_of_antiswish = llEuler2Rot( degrees_of_antiswish );
  55. llSetTimerEvent( 1.5 );
  56. side = 1;
  57. }
  58. timer()
  59. {
  60. if ( side != 1 )
  61. {
  62. //llSetLocalRot( llGetLocalRot() * quat_of_swish );
  63. //llSetPrimitiveParams([ PRIM_ROTATION, ( (llGetRot() * quat_of_swish) / llGetRootRotation() ) ]);
  64. llSetPrimitiveParams([ PRIM_ROTATION, ( quat_of_swish * llGetRootRotation() ) ]);
  65. side = 1;
  66. }
  67. else
  68. {
  69. //llSetLocalRot( llGetLocalRot() * quat_of_antiswish );
  70. //llSetPrimitiveParams([ PRIM_ROTATION, ( (llGetRot() * quat_of_antiswish) / llGetRootRotation() ) ]);
  71. llSetPrimitiveParams([ PRIM_ROTATION, ( quat_of_antiswish * llGetRootRotation() ) ]);
  72. side = 2;
  73. }
  74. }
  75. }
  76. // Please leave the following line intact to show where the script lives in Git:
  77. // SLOODLE LSL Script Git Location: mod/gaming-1.0/objects/shark/assets/movelikeashark.lslp