general refactor; script updates; new sample script added;
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
-- This script will draw some debug primitives in the world such as line, point, box
|
||||
killProcesses() -- stops all running lua coroutine processes
|
||||
|
||||
backlog_post("---> START SCRIPT: debug_draw.lua")
|
||||
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
-- This script will load a particle emitter model and burst-spawn particles from it periodically
|
||||
killProcesses() -- stops all running lua coroutine processes
|
||||
|
||||
backlog_post("---> START SCRIPT: emitter_burst.lua")
|
||||
|
||||
scene = GetScene()
|
||||
scene.Clear()
|
||||
LoadModel("../models/emitter_smoke.wiscene")
|
||||
emitter_entity = scene.Entity_FindByName("smoke") -- query the emitter entity by name
|
||||
emitter_component = scene.Component_GetEmitter(emitter_entity)
|
||||
emitter_component.SetEmitCount(0) -- don't emit continuously
|
||||
emitter_component.SetNormalFactor(20) -- set starting speed to particles
|
||||
emitter_component.SetLife(0.3) -- particles will be short lived (around 0.3 sec if we don't account for life randomness)
|
||||
emitter_component.SetSize(0.1) -- adjust starting particle size
|
||||
|
||||
runProcess(function()
|
||||
while true do
|
||||
emitter_component.Burst(50) -- Burst 50 particles at once
|
||||
waitSeconds(2) -- then wait for 2 seconds before bursting again
|
||||
end
|
||||
end)
|
||||
|
||||
backlog_post("---> END SCRIPT: emitter_burst.lua")
|
||||
@@ -1,4 +1,5 @@
|
||||
-- This script will load a teapot model with lights, and move the teapot's lid up and down
|
||||
killProcesses() -- stops all running lua coroutine processes
|
||||
|
||||
backlog_post("---> START SCRIPT: move_object.lua")
|
||||
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
-- This script will load a teapot model and demonstrate picking it with a ray
|
||||
killProcesses() -- stops all running lua coroutine processes
|
||||
|
||||
backlog_post("---> START SCRIPT: pick.lua")
|
||||
|
||||
@@ -9,7 +10,7 @@ model_entity = LoadModel("../models/teapot.wiscene")
|
||||
runProcess(function()
|
||||
local t = 0
|
||||
while true do
|
||||
t = t + 0.05
|
||||
t = t + 0.02
|
||||
|
||||
-- Create a Ray by specifying origin and direction (and also animate the ray origin along sine wave):
|
||||
local ray = Ray(Vector(math.sin(t) * 4,1,-10), Vector(0,0,1))
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
-- This script will load a teapot model with lights and rotate the whole model
|
||||
killProcesses() -- stops all running lua coroutine processes
|
||||
|
||||
backlog_post("---> START SCRIPT: rotate_model.lua")
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
-- This script will load a teapot model and animate its base color between red and green
|
||||
killProcesses() -- stops all running lua coroutine processes
|
||||
|
||||
backlog_post("---> START SCRIPT: set_material_color.lua")
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
-- This script will load a teapot model and animate its emissive color and intensity
|
||||
killProcesses() -- stops all running lua coroutine processes
|
||||
|
||||
backlog_post("---> START SCRIPT: set_material_color.lua")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user