void CEntityAudioProxy::OnMove() { Matrix34 tm = m_pEntity->GetWorldTM(); if (tm.IsValid()) { SATLWorldPosition const oPosition(tm, ZERO); std::for_each(m_mapAuxAudioProxies.begin(), m_mapAuxAudioProxies.end(), SRepositionAudioProxy(oPosition)); if ((m_pEntity->GetFlagsExtended() & ENTITY_FLAG_EXTENDED_AUDIO_LISTENER) != 0) { SAudioRequest oRequest; oRequest.nFlags = eARF_PRIORITY_NORMAL; oRequest.pOwner = this; SAudioListenerRequestData<eALRT_SET_POSITION> oRequestData(oPosition); oRequest.pData = &oRequestData; gEnv->pAudioSystem->PushRequest(oRequest); // As this is an audio listener add its entity to the AreaManager for raising audio relevant events. gEnv->pEntitySystem->GetAreaManager()->MarkEntityForUpdate(m_pEntity->GetId()); } } REINST("voice attachement lookup needs to be done by code creating entityaudioproxy for voice line on character"); //if (m_nAttachmentIndex != -1) //{ // if (ICharacterInstance* const pCharacter = m_pEntity->GetCharacter(0)) // { // if (m_nAttachmentIndex != -1) // { // if (IAttachmentManager const* const pAttachmentManager = pCharacter->GetIAttachmentManager()) // { // if (IAttachment const* const pAttachment = pAttachmentManager->GetInterfaceByIndex(m_nAttachmentIndex)) // { // tm = Matrix34(pAttachment->GetAttWorldAbsolute()); // } // } // } // else if (m_nBoneHead != -1) // { // // re-query SkeletonPose to prevent crash on removed Character // if (ISkeletonPose* const pSkeletonPose = pCharacter->GetISkeletonPose()) // { // tm = tm * Matrix34(pSkeletonPose->GetAbsJointByID(m_nBoneHead)); // } // } // } //} }
bool CMFXParticleEffect::AttachToEntity( IEntity& targetEntity, const SMFXParticleEntry& particleParams, const SMFXRunTimeEffectParams& params, IParticleEffect* pParticleEffect, const Vec3& dir, float scale ) { if (pParticleEffect) { int effectSlot = targetEntity.LoadParticleEmitter(-1, pParticleEffect); if (effectSlot >= 0) { Matrix34 hitTM; hitTM.Set(Vec3(1.0f, 1.0f, 1.0f), Quat::CreateRotationVDir(dir), params.pos); Matrix34 localEffectTM = targetEntity.GetWorldTM().GetInverted() * hitTM; localEffectTM.ScaleColumn(Vec3(scale, scale, scale)); CRY_ASSERT(localEffectTM.IsValid()); targetEntity.SetSlotLocalTM(effectSlot, localEffectTM); return true; } } return false; }
virtual void ProcessEvent(EFlowEvent event, SActivationInfo *pActInfo) { switch (event) { case eFE_Initialize:{ pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID,true); } case eFE_Activate: { pActInfo->pGraph->SetRegularlyUpdated(pActInfo->myID,true); } break; case eFE_Update: { //if (IsPortActive(pActInfo, PORT_IN_ENABLE)) //{ EntityId id = GetPortEntityId(pActInfo,EIP_EntityID); EntityId parentid = GetPortEntityId(pActInfo,EIP_ParentEntityID); //IGameObject *pGameObj = gEnv->pGameFramework->GetGameObject(id); IEntity * entity = gEnv->pEntitySystem->GetEntity(id); IEntity * parententity = gEnv->pEntitySystem->GetEntity(parentid); if(entity){ Matrix34 trans; // = entity->GetWorldTM(); trans.CreateIdentity(); Matrix34 transparent; transparent.CreateIdentity(); if (parententity){ //quatParent = parententity->GetRotation(); transparent = parententity->GetWorldTM(); //CryLogAlways("Parent : [%f,%f,%f]",transparent.GetColumn0().x,transparent.GetColumn0().y,transparent.GetColumn0().z); //CryLogAlways("Parent : [%f,%f,%f]",transparent.GetColumn1().x,transparent.GetColumn1().y,transparent.GetColumn1().z); //CryLogAlways("Parent : [%f,%f,%f]",transparent.GetColumn2().x,transparent.GetColumn2().y,transparent.GetColumn2().z); //CryLogAlways("Parent : [%f,%f,%f]",transparent.GetColumn3().x,transparent.GetColumn3().y,transparent.GetColumn3().z); } Quat quat = entity->GetRotation(); quat.v = GetPortVec3( pActInfo, EIP_Rotation_XYZ); quat.w = GetPortFloat( pActInfo, EIP_Rotation_W); quat.NormalizeFast(); Vec3 position = GetPortVec3(pActInfo, EIP_Position); trans.Set(Vec3(1,1,1),quat.GetNormalized(),position); //transparent.SetTranslation(Vec3(0,0,0)); Vec3 positionlocal = transparent.TransformVector(position); trans = transparent * trans; //Matrix34 transresult ; //transresult.CreateIdentity(); //transresult.Scale trans.SetTranslation(positionlocal+parententity->GetPos()); if(trans.IsValid()){ entity->SetWorldTM(trans); } else { //CryLogAlways("[%f,%f,%f]",trans.GetColumn0().x,trans.GetColumn0().y,trans.GetColumn0().z); //CryLogAlways("[%f,%f,%f]",trans.GetColumn1().x,trans.GetColumn1().y,trans.GetColumn1().z); //CryLogAlways("[%f,%f,%f]",trans.GetColumn2().x,trans.GetColumn2().y,trans.GetColumn2().z); //CryLogAlways("[%f,%f,%f]",trans.GetColumn3().x,trans.GetColumn3().y,trans.GetColumn3().z); //CryLogAlways("rot : [%f,%f,%f,%f]",trans.GetRo); //CryLogAlways("sca : [%f,%f,%f]",trans.GetColumn0().x,trans.GetColumn0().y,trans.GetColumn0().z); } } //CryLogAlways("%i",id); //} } } }