summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcommon/llcallbacklist.cpp2
-rw-r--r--indra/newview/scripts/lua/test_flycam.lua38
2 files changed, 39 insertions, 1 deletions
diff --git a/indra/llcommon/llcallbacklist.cpp b/indra/llcommon/llcallbacklist.cpp
index 555c793333..647b268b8b 100644
--- a/indra/llcommon/llcallbacklist.cpp
+++ b/indra/llcommon/llcallbacklist.cpp
@@ -391,7 +391,7 @@ public:
TimersListener(const LazyEventAPIParams& params): LLEventAPI(params) {}
// Forbid a script from requesting callbacks too quickly.
- static constexpr LLSD::Real MINTIMER{ 1.0 };
+ static constexpr LLSD::Real MINTIMER{ 0.010 };
void scheduleAfter(const LLSD& params);
void scheduleEvery(const LLSD& params);
diff --git a/indra/newview/scripts/lua/test_flycam.lua b/indra/newview/scripts/lua/test_flycam.lua
new file mode 100644
index 0000000000..4fb5608b33
--- /dev/null
+++ b/indra/newview/scripts/lua/test_flycam.lua
@@ -0,0 +1,38 @@
+-- Make camera fly around the subject avatar for a few seconds.
+
+local LLAgent = require 'LLAgent'
+local startup = require 'startup'
+local timers = require 'timers'
+
+local initial = LLAgent.getRegionPosition()
+local height = 2.0 -- meters
+local radius = 4.0 -- meters
+local speed = 1.0 -- meters/second along circle
+local start = os.clock()
+local stop = os.clock() + 30 -- seconds
+
+local function cameraPos(t)
+ local radians = speed * t
+ return {
+ initial[1] + radius * math.cos(radians),
+ initial[2] + radius * math.sin(radians),
+ initial[3] + height
+ }
+end
+
+local function moveCamera()
+ if os.clock() < stop then
+ -- usual case
+ LLAgent.setCamera{ camera_pos=cameraPos(os.clock() - start), camera_locked=true }
+ return nil
+ else
+ -- last time
+ LLAgent.removeCamParams()
+ LLAgent.setFollowCamActive(false)
+ return true
+ end
+end
+
+startup.wait('STATE_STARTED')
+-- call moveCamera() repeatedly until it returns true
+local timer = timers.Timer(0.1, moveCamera, true)