CBEffects : Rotate vent to match object rotation

Hi, I’m just getting started with CBE and I’m liking it so far.  In my current project I have a player ship that can be rotated through 360 degrees, and I’d like an emitter a vent to rotate with it for an exhaust effect.

Looking through the docs I can’t see anything obvious that would enable me to do this.  Is it possible, and if so how?

Many thanks.

An emitter object has the “angle” property, as stated in the docs.

https://docs.coronalabs.com/api/type/EmitterObject/index.html

Mabye you could ajust it to your needs?

Cheers for that Torben, but I’m wanting to use CBEffects rather than Corona’s particle system.

Anyone else have an idea?

Below is some sample code that uses a timer to change the angle of the laser, both the velocity and the rotation of the individual particles. Hopefully, this points you in the right direction.

local angle = 0 timer.performWithDelay(100, function() angle = angle - 5 end, -1) local angles = CBE.newVent({ title = "angles", preset = "lasergun", onCreation = function(particle, vent) particle:setVelocity(10 \* math.cos(angle\*(math.pi/180)), 10 \* math.sin(angle\*(math.pi/180))) particle.rotation = angle end, }) angles:start()

Hi and sorry for not seeing this sooner.

This is built into CBE:

vent.angles = {10, 15, 20} vent:resetAngles() -- Use this to make the vent recalculate particle trajectories
  • Caleb

An emitter object has the “angle” property, as stated in the docs.

https://docs.coronalabs.com/api/type/EmitterObject/index.html

Mabye you could ajust it to your needs?

Cheers for that Torben, but I’m wanting to use CBEffects rather than Corona’s particle system.

Anyone else have an idea?

Below is some sample code that uses a timer to change the angle of the laser, both the velocity and the rotation of the individual particles. Hopefully, this points you in the right direction.

local angle = 0 timer.performWithDelay(100, function() angle = angle - 5 end, -1) local angles = CBE.newVent({ title = "angles", preset = "lasergun", onCreation = function(particle, vent) particle:setVelocity(10 \* math.cos(angle\*(math.pi/180)), 10 \* math.sin(angle\*(math.pi/180))) particle.rotation = angle end, }) angles:start()

Hi and sorry for not seeing this sooner.

This is built into CBE:

vent.angles = {10, 15, 20} vent:resetAngles() -- Use this to make the vent recalculate particle trajectories
  • Caleb