Modeling a candle flame in Objective-C

As part of the current project, I was asked to display a candle on the screen. Users should be able to tilt the device to tilt the flame and perform an action (such as a tap) to blow out the flame. I am in a real loss of how to achieve this. Some ideas that I had:

  • buy a candle movie from a video site. This will not let me tilt or blow out the flame, although
  • get a few frames and animate them to create the appearance of a flickering flame
  • use some form of particle emitter.

I believe that my advantage would probably be the use of a particle emitter, since I do not see that working with video and obtaining the necessary resources for animating a frame can be a problem. I know that Cocos2D has a particle emitter, but it is part of a larger UIKit project that cannot be broken and started building on top of Cocos2D again.

Does anyone have any ideas on how I can achieve this?

+4
source share
4 answers

You can see the Nehe Particle Generation tutorial:

http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=19

It would be easy to adapt this to create something like a candle.

(You can embed the GL view in a different view for this.)

+1
source

For the previous project, we had a website that had to β€œrecord” in order to open a new website below. This was achieved by recording the image of a burning piece of paper, and then involving those who were good at graphic manipulations for cleaning and looping the video - this was done in Flash.

What you can do is apply this technique to your candlestick video. Find out which shots you need to simulate all the states you want to create, including tipping over and blowing out flames, and recording them. Then pass this on to someone who can create animation loops.

Obviously, something like this will cost a little money, but it will create a better result.

Realistic flame is really hard to use the graphics engine, and it will look fake - if you do not have a big budget.

+1
source

This is not an Objective-C question. What you need is an introduction to creating OpenGL shaders.

0
source

You can still use the particle generator in GL and run it in a layer on top of your other interface so you don't have to break your entire application. I have seen some people complain about performance mixing these methodologies, but for a simple case it should work fine.

0
source

All Articles