void CParticlesPlayer::StartParticles(const shared_str& particles_name, u16 bone_num, const Fmatrix& xform, u16 sender_id, int life_time, bool auto_stop) { VERIFY(fis_zero(xform.c.magnitude())); R_ASSERT(*particles_name); CObject* object = m_self_object; VERIFY(object); SBoneInfo* pBoneInfo = get_nearest_bone_info(smart_cast<CKinematics*>(object->Visual()),bone_num); if(!pBoneInfo) return; SParticlesInfo &particles_info =*pBoneInfo->AppendParticles(object,particles_name); particles_info.sender_id = sender_id; particles_info.life_time=auto_stop ? life_time : u32(-1); xform.getHPB(particles_info.angles); Fmatrix m; m.setHPB(particles_info.angles.x,particles_info.angles.y,particles_info.angles.z); GetBonePos(object,pBoneInfo->index,pBoneInfo->offset,m.c); particles_info.ps->UpdateParent(m,zero_vel); if(!particles_info.ps->IsPlaying()) particles_info.ps->Play (); m_bActiveBones = true; }
void calc_cam_diff_rot(Fmatrix item_transform, Fvector diff, Fvector& res) { Fmatrix cam_m; cam_m.i.set (Device.vCameraRight); cam_m.j.set (Device.vCameraTop); cam_m.k.set (Device.vCameraDirection); cam_m.c.set (Device.vCameraPosition); Fmatrix R; R.identity (); if(!fis_zero(diff.x)) { R.rotation(cam_m.i,diff.x); }else if(!fis_zero(diff.y)) { R.rotation(cam_m.j,diff.y); }else if(!fis_zero(diff.z)) { R.rotation(cam_m.k,diff.z); }; Fmatrix item_transform_i; item_transform_i.invert (item_transform); R.mulB_43(item_transform); R.mulA_43(item_transform_i); R.getHPB (res); res.mul (180.0f/PI); }
void CParticlesPlayer::StartParticles(const shared_str& ps_name, const Fmatrix& xform, u16 sender_id, int life_time, bool auto_stop) { CObject* object = m_self_object; VERIFY(object); for(BoneInfoVecIt it = m_Bones.begin(); it!=m_Bones.end(); it++) { SParticlesInfo &particles_info =*it->AppendParticles(object,ps_name); particles_info.sender_id = sender_id; particles_info.life_time=auto_stop ? life_time : u32(-1); xform.getHPB(particles_info.angles); //начать играть партиклы Fmatrix m; m.set(xform); GetBonePos(object,it->index,it->offset,m.c); particles_info.ps->UpdateParent(m,zero_vel); if(!particles_info.ps->IsPlaying()) particles_info.ps->Play (); } m_bActiveBones = true; }