Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Bird Hummy  

Hummy

hummingbird flight

Category: Bird
By : Ferd Frederix
Created: 2013-09-06 Edited: 2013-09-04
Worlds: Second Life

the Zip file

Download all files for Hummy
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Hummy script.lsl

This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1
2 // Simple Hummingbird
3 // opensim 0.1
4
5
6 vector startPos;
7 float dist = 10;
8 integer debug = 1;
9
10 DEBUG(string msg)
11 {
12 if(debug) llOwnerSay(msg);
13 }
14
15 // This is an OpenSim compatible llLookAt()
16
17 face_target(vector lookat)
18 {
19 rotation rot = llGetRot() * llRotBetween(<0.0 ,0.0 ,1.0 > * llGetRot(), lookat - llGetPos());
20 llSetRot(rot);
21 }
22
23
24 vector getDestination()
25 {
26 float x = llFrand(dist) + startPos.x;
27 float y = llFrand(dist) + startPos.y;
28 float z= llFrand(1) + startPos.z;
29
30 vector result = <x,y,z>;
31
32 DEBUG((string) result);
33 return result;
34 }
35
36 default
37 {
39 {
40
41 // debug
42 //llSetPos(<240, 330, 21>);
43
44 vector rezPos = llGetPos();
45 rezPos.z += 1;
46 llSetPos(rezPos);
47
48 vector new = <0,0,0> * DEG_TO_RAD;
49 rotation r = llEuler2Rot(new);
50 llSetRot(r);
51 startPos = llGetPos();
52 llSensorRepeat("", NULL_KEY, AGENT, dist, PI, 5);
53 llSetTimerEvent(.1); // move every 5 seconds
54
55 }
56
58 {
60 }
61
62 timer()
63 {
64 vector dest = getDestination();
65 vector new = <00,0,0> * DEG_TO_RAD;
66 rotation r = llEuler2Rot(new);
67
68 face_target(dest);
69
70
71 llSetPos(dest);
72
73 llSetRot(r);
74
75 llSetTimerEvent(llFrand(5) + 1); // move every 1-6 seconds
76 }
77
78 sensor(integer numDetected)
79 {
80 llSetTimerEvent(0); // move every 1-6 seconds
81 integer j;
82 for (j = 0; j < numDetected; j++)
83 {
84 //vector new = <0,0,0> * DEG_TO_RAD;
85 //rotation r = llEuler2Rot(new);
86
87 vector detected = llDetectedPos(j);
88 vector avatar = detected;
89
90 float rand = llFrand(2);
91 if(rand > 1)
92 detected.x = detected.x +1;
93 else
94 detected.x = detected.x -1;
95
96 rand = llFrand(2);
97 if(rand > 1)
98 detected.y = detected.y +1;
99 else
100 detected.y = detected.y -1;
101
102 detected.z += rand;
103 avatar.z += rand;
104
105 face_target(detected);
106 llSetPos(detected);
107 face_target(avatar);
108
109 }
110 }
111
112 no_sensor()
113 {
115 }
116 }

Back to the Best Free Tools in Second Life and OpenSim.