Particle effect facing direction
Posted: Sun Dec 30, 2012 10:59 pm
I'm trying to get a particle effect to play when the player places a gem in a daemon mouth. I can get the effect to spawn when the gem is placed, but it is only centered on the mouth when the mouth is on the north wall, any other wall the effect is still shown to the north. I set the facing of the FX from the facing of the mouth socket, but that doesn't appear to change anything.
Objects
Particles (tweaked from the crystal):
Is this the right way to rotate a particle effect? And am I spawning the fx right? It seems that this method creates a new fx every time the gem is is placed in a mouth; do I need to worry about leaking the fx object?
Objects
Code: Select all
cloneObject{
name = "hlodian_mouth_socket",
baseObject = "mouth_socket",
onInsertItem = function(self, item)
if item.name == "hlodian_gem" and self:getItemCount() == 0 then
fx = spawn("fx", self.level, self.x, self.y, self.facing)
fx:setParticleSystem("place_gem_mouth")
return true
else
return false
end
end,
}
cloneObject{
name = "hlodian_gem",
baseObject = "red_gem",
uiName = "Hlodian Gem"
}Code: Select all
defineParticleSystem{
name = "place_gem_mouth",
emitters = {
-- fog
{
emissionRate = 100,
emissionTime = .5,
maxParticles = 1000,
boxMin = { -.2, 1.05, 1.1},
boxMax = { .2, 1.05, 1.1},
sprayAngle = {0,360},
velocity = {0.1,0.2},
objectSpace = true,
texture = "assets/textures/particles/fog.tga",
lifetime = {1.5,1.5},
color0 = {0.803922, 0.2, 0.2},
opacity = 1,
fadeIn = 2.2,
fadeOut = 2.2,
size = {.5, .5},
gravity = {0,0,0},
airResistance = 0.1,
rotationSpeed = 0.3,
blendMode = "Additive",
objectSpace = true,
},
-- stars
{
emissionRate = 50,
emissionTime = .5,
maxParticles = 1000,
boxMin = {-0, 1.1, 1.1},
boxMax = { 0, 1.1, 1.1},
sprayAngle = {0,360},
velocity = {0.2,0.2},
objectSpace = true,
texture = "assets/textures/particles/teleporter.tga",
lifetime = {1,1},
color0 = {3.0,1,1},
opacity = 1,
fadeIn = 0.1,
fadeOut = 0.1,
size = {0.05, 0.13},
gravity = {0,0,0},
airResistance = 0.1,
rotationSpeed = 2,
blendMode = "Additive",
objectSpace = true,
}
}
}