Blade strike push.lsl 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // :CATEGORY:Tour
  2. // :NAME:TourCopter
  3. // :AUTHOR:Ferd Frederix
  4. // :CREATED:2013-09-06
  5. // :EDITED:2013-09-18 15:39:08
  6. // :ID:909
  7. // :NUM:1290
  8. // :REV:1
  9. // :WORLD:Second Life
  10. // :DESCRIPTION:
  11. // Tour
  12. // :CODE:
  13. // ______ _ ______ _ _
  14. // | ___| | | | ___| | | (_)
  15. // | |_ ___ _ __ __| | | |_ _ __ ___ __| | ___ _ __ ___ __
  16. // | _/ _ \ '__/ _` | | _| '__/ _ \/ _` |/ _ \ '__| \ \/ /
  17. // | || __/ | | (_| | | | | | | __/ (_| | __/ | | |> <
  18. // \_| \___|_| \__,_| \_| |_| \___|\__,_|\___|_| |_/_/\_\
  19. //
  20. // fred@mitsi.com
  21. // tour copter script
  22. // blade strike push
  23. //
  24. //Revisions:
  25. // 1/28/2010 initial release
  26. vector local_pos;
  27. float mass;
  28. integer i;
  29. integer on = FALSE;
  30. default
  31. {
  32. link_message(integer sender, integer num, string str, key id)
  33. {
  34. if (str == "start") {
  35. on = TRUE;
  36. } else if (str == "stop") {
  37. on = FALSE;
  38. }
  39. }
  40. collision_start(integer n)
  41. {
  42. if (!on) return;
  43. for (i = 0; i < n && i < 3; i += 1)
  44. {
  45. if (llDetectedLinkNumber(i) == llGetLinkNumber())
  46. {
  47. mass = llGetObjectMass(llDetectedKey(i));
  48. if ((llDetectedType(i) & AGENT) == AGENT)
  49. {
  50. local_pos = llDetectedPos(i) - llGetPos();
  51. if ((llGetAgentInfo(llDetectedKey(i)) & AGENT_FLYING) == AGENT_FLYING) {
  52. llPushObject(llDetectedKey(i), llVecNorm(local_pos) * ((llVecMag(local_pos) * 0.4) + 1.0) * mass * llPow(llVecMag(local_pos) + 0.1, 3.0), ZERO_VECTOR, FALSE);
  53. } else {
  54. llPushObject(llDetectedKey(i), llVecNorm(local_pos) * ((llVecMag(local_pos) * 0.2) + 1.0) * mass * llPow(llVecMag(local_pos) + 0.1, 3.0), ZERO_VECTOR, FALSE);
  55. }
  56. } else if (llDetectedVel(i) != ZERO_VECTOR && mass > 1.0) {
  57. local_pos = llDetectedPos(i) - llGetPos();
  58. llPushObject(llDetectedKey(i), llVecNorm(local_pos) * ((llVecMag(local_pos) * 0.15) + 1.5) * mass * llPow(llVecMag(local_pos) + 0.1, 3.0), ZERO_VECTOR, FALSE);
  59. }
  60. }
  61. }
  62. }
  63. }