ioscocos2d-iphoneblender3dsmaxcocos3d

Play audio file in Cocos3d


I'm using Blender tool to create models,I have included the animations and audio in the model and exported in POD format. Now when I run the POD file in iOS app using Cocos3d, the animation runs fine but not the audio which I have included.

So my question is "Can we include audio in the POD files?"

If YES "Why isn't it playing?"

If NO "How can I play it using Cocos3d?And I have to start playing the audio at a particular frame."


Solution

  • POD files are strictly binary 3D model files. There is no audio track available within a POD file.

    Cocos3D audio support is provided by the Cocos2D framework.

    In Cocos3D, animation is run by the CC3ActionAnimate action. As far as synchronizing audio with animation timeframes, you might try creating a CCActionSequence containing the following actions in sequence:

    1. CC3ActionAnimate to animate the node up to the point where you want to play your sound effect.
    2. CCActionCallBlock to start the audio effect playing
    3. CC3ActionAnimate to animate the remaining content of the node animation.

    Or you could just run a single CC3ActionAnimate for the entire animation, and, at the same time, run a separate CCActionSequence containing a CCActionDelay and CCActionCallBlock to start the audio after a certain delay.

    ...Bill