Game Development Community

[is T3D bug?] SFX playOnce function

by Enel · in Torque 3D Professional · 06/27/2010 (6:43 am) · 0 replies

im using playOnce function when animation trigger

datablock SFXProfile(DeerWalk1)
{
   filename = "art/sound/Deer/walk/step1.ogg";
   description = AudioClosest3D;
   preload = true;
};

//player.cpp
if(triggeredLeft){
					   if(mActionAnimation.action == PlayerData::walkAnim)
						   SFX->playOnce( mDataBlock->sound[PlayerData::BaseWalk1], &footMat ,NULL,true);
					   else
						   SFX->playOnce( mDataBlock->sound[PlayerData::BaseRun1], &footMat ,NULL,true);
				   }
				   if(triggeredRight)
				   {
   					   if(mActionAnimation.action == PlayerData::walkAnim)
						   SFX->playOnce( mDataBlock->sound[PlayerData::BaseWalk2], &footMat ,NULL,true);
					   else
						   SFX->playOnce( mDataBlock->sound[PlayerData::BaseRun2], &footMat ,NULL,true);
				   }


playOnce works fine when i play ControlObject

but when i'm approach AIObject. playOnce works that im not expect direction

To explane, before I'm approach to Aiobject. Aiobject execute playonce function in succession Thus sounds pile up to position

and than In accordance with infomation of DeerWalk1, piled up sounds has all play At once


how can i solve it?..