I created particle streams to mimic the wake and bow wave from my boat. They were working, and I could vary the intensity, but for some reason the code is now throwing errors.
I establish the particle streams and establish their intensities with this code, called within clbk_setclasscaps:
Both instances of oapi.particle_getlevelref cause errors (from Orbiter.log): oapi_particle_getlevelref: Argument 1: invalid object. I am again stumped, as I define the particle streams before these calls in the same block! I get no other errors in Orbiter.log set to verbose.
I establish the particle streams and establish their intensities with this code, called within clbk_setclasscaps
Code:
function make_pretty.particle_streams()
wake_particle_spec =
{
flags = 0,
srcsize = 0.5,
srcrate = 10,
v0 = 0,
srcspread = 0.25,
lifetime = 2.0,
growthrate = 0,
atmslowdown = 2.0,
ltype = PARTICLE.DIFFUSE,
levelmap = PARTICLE.LVL_PSQRT,
lmin = 0,
lmax = 2,
atmsmap = PARTICLE.ATM_PLOG,
amin = 1e-4,
amax = 1,
tex = 0
}
bow_wave_particle_spec =
{
flags = 0,
srcsize = 0.5,
srcrate = 20,
v0 = 1,
srcspread = 0.1,
lifetime = 1.0,
growthrate = 0,
atmslowdown = 0.0,
ltype = PARTICLE.DIFFUSE,
levelmap = PARTICLE.LVL_PSQRT,
lmin = 0,
lmax = 2,
atmsmap = PARTICLE.ATM_PLOG,
amin = 1e-4,
amax = 1,
tex = 0
}
wake_level = 1
bow_level = 1
wake = {}
wake[1] = vi:add_particlestream(wake_particle_spec, vec.add(rudder_pivot, {x=0, y=0, z=-0.5}), {x=0, y=0, z=-1}, wake_level)
wake[2] = vi:add_particlestream(wake_particle_spec, vec.add(rudder_pivot, {x=-0.35, y=0, z=-0.5}), {x=0, y=0, z=-1}, wake_level)
wake[3] = vi:add_particlestream(wake_particle_spec, vec.add(rudder_pivot, {x=-0.7, y=0, z=-0.5}), {x=0, y=0, z=-1}, wake_level)
wake[4] = vi:add_particlestream(wake_particle_spec, vec.add(rudder_pivot, {x=0.35, y=0, z=-0.5}), {x=0, y=0, z=-1}, wake_level)
wake[5] = vi:add_particlestream(wake_particle_spec, vec.add(rudder_pivot, {x=0.7, y=0, z=-0.5}), {x=0, y=0, z=-1}, wake_level)
bow_wave = {}
bow_wave[1] = vi:add_particlestream(bow_wave_particle_spec, vec.add(rudder_pivot, {x=0, y=0, z=5.2}), {x=10, y=0, z=0}, bow_level)
bow_wave[2] = vi:add_particlestream(bow_wave_particle_spec, vec.add(rudder_pivot, {x=0, y=0, z=5.2}), {x=-10, y=0, z=0}, bow_level)
wake_intensity = {}
for i = 1, #wake do
if wake ~= nil then
wake_intensity[i] = oapi.particle_getlevelref(wake[i])
end
end
bow_wave_intensity = {}
for i = 1, #bow_wave do
if bow_wave[i] ~= nil then
bow_wave_intensity[i] = oapi.particle_getlevelref(bow_wave[i])
end
end
end
Both instances of oapi.particle_getlevelref cause errors (from Orbiter.log): oapi_particle_getlevelref: Argument 1: invalid object. I am again stumped, as I define the particle streams before these calls in the same block! I get no other errors in Orbiter.log set to verbose.