Is it possible to have an object with multiple "Particle" classes, and then start/stop them individually?
I have tried the code below, but I can't figure out how to address the different named particle classes.
Is there a specific way to address a component when there are more than one of a type? Just the name doesn't seem to work. It returns:
Error: attempt to index field 'particle_droplets' (a nil value)
Thanks for your help
SpoilerShow
Code: Select all
defineObject{ --light rain object
name = "light_rain",
components = {
{
class = "Particle",
name = "particle_droplets",
particleSystem = "light_rain_droplets",
},
{
class = "Particle",
name = "particle_splash",
particleSystem = "light_rain_splash",
},
{
class = "Particle",
name = "particle_clouds",
particleSystem = "light_rain_clouds",
},
{
class = "Controller",
onActivate = function(self)
self.particle_droplets:start()
self.timer_1:start()
end,
onDeactivate = function(self)
self.particle_droplets:stop()
self.timer_2:start()
end,
},
{
class = "Timer",
name = "timer_1",
disableSelf = true,
trigerOnStart = false,
timerInterval = 5.0,
onActivate = function(self)
self.go.particle_splash:start()
end,
},
{
class = "Timer",
name = "timer_2",
disableSelf = true,
trigerOnStart = false,
timerInterval = 5.0,
onActivate = function(self)
self.go.particle_splash:stop()
end,
},
},
placement = "floor",
}