本文整理汇总了C++中Fmatrix::set方法的典型用法代码示例。如果您正苦于以下问题:C++ Fmatrix::set方法的具体用法?C++ Fmatrix::set怎么用?C++ Fmatrix::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fmatrix
的用法示例。
在下文中一共展示了Fmatrix::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_Shape
void CPHGeometryOwner::add_Shape(const SBoneShape& shape,const Fmatrix& offset)
{
switch(shape.type) {
case SBoneShape::stBox :
{
Fobb box=shape.box;
Fmatrix m;
m.set(offset);
//Fmatrix position;
//position.set(box.m_rotate);
//position.c.set(box.m_translate);
//position.mulA(offset);
//box.m_rotate.set(position);
//box.m_translate.set(position.c);
box.transform(box,m);
add_Box(box);
break;
}
case SBoneShape::stSphere :
{
Fsphere sphere=shape.sphere;
offset.transform_tiny(sphere.P);
add_Sphere(sphere);
break;
}
case SBoneShape::stCylinder :
{
Fcylinder C=shape.cylinder;
offset.transform_tiny(C.m_center);
offset.transform_dir(C.m_direction);
add_Cylinder(C);
break;
}
case SBoneShape::stNone :
break;
default: NODEFAULT;
}
}
示例2: RotateLocal
void CGroupObject::RotateLocal(Fvector& axis, float angle )
{
inherited::RotateLocal(axis,angle);
Fmatrix Ginv;
Ginv.set (FITransformRP);
UpdateTransform (true);
for (ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); it++){
Fmatrix O,On;
O.mul (Ginv,(*it)->FTransformRP);
On.mul (FTransform,O);
Fvector xyz;
On.getXYZ (xyz);
(*it)->NumSetRotation(xyz);
(*it)->NumSetPosition(On.c);
// (*it)->PivotRotateParent(m_old,FTransform,axis,angle);
}
/*
for (ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); it++)
(*it)->PivotRotateLocal(FTransformRP,FPosition,axis,angle);
*/
}
示例3:
void CShootingObject::UpdateFlameParticles ()
{
if(0==m_sFlameParticlesCurrent.size()) return;
if(!m_pFlameParticles) return;
Fmatrix pos;
pos.set (get_ParticlesXFORM() );
pos.c.set (get_CurrentFirePoint() );
VERIFY(_valid(pos));
m_pFlameParticles->SetXFORM (pos);
if(!m_pFlameParticles->IsLooped() &&
!m_pFlameParticles->IsPlaying() &&
!m_pFlameParticles->PSI_alive())
{
m_pFlameParticles->Stop();
CParticlesObject::Destroy(m_pFlameParticles);
}
}
示例4: Die
void CPoltergeist::Die(CObject* who)
{
if (m_tele) {
if (state_invisible) {
setVisible(true);
if (PPhysicsShell()) {
Fmatrix M;
M.set (XFORM());
M.translate_over (m_current_position);
PPhysicsShell()->SetTransform (M);
} else
Position() = m_current_position;
}
}
inherited::Die (who);
Energy::disable ();
ability()->on_die ();
}
示例5: StartParticles
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;
}
示例6:
void CWeapon::UpdateXForm ()
{
if (Device.dwFrame == dwXF_Frame)
return;
dwXF_Frame = Device.dwFrame;
if (!H_Parent())
return;
// Get access to entity and its visual
CEntityAlive* E = smart_cast<CEntityAlive*>(H_Parent());
if (!E) {
if (!IsGameTypeSingle())
UpdatePosition (H_Parent()->XFORM());
return;
}
const CInventoryOwner *parent = smart_cast<const CInventoryOwner*>(E);
if (parent && parent->use_simplified_visual())
return;
if (parent->attached(this))
return;
IKinematics* V = smart_cast<IKinematics*> (E->Visual());
VERIFY (V);
// Get matrices
int boneL = -1, boneR = -1, boneR2 = -1;
// this ugly case is possible in case of a CustomMonster, not a Stalker, nor an Actor
E->g_WeaponBones (boneL,boneR,boneR2);
if (boneR == -1) return;
if ((HandDependence() == hd1Hand) || (GetState() == eReload) || (!E->g_Alive()))
boneL = boneR2;
V->CalculateBones ();
Fmatrix& mL = V->LL_GetTransform(u16(boneL));
Fmatrix& mR = V->LL_GetTransform(u16(boneR));
// Calculate
Fmatrix mRes;
Fvector R,D,N;
D.sub (mL.c,mR.c);
if(fis_zero(D.magnitude())) {
mRes.set (E->XFORM());
mRes.c.set (mR.c);
}
else {
D.normalize ();
R.crossproduct (mR.j,D);
N.crossproduct (D,R);
N.normalize ();
mRes.set (R,N,D,mR.c);
mRes.mulA_43 (E->XFORM());
}
UpdatePosition (mRes);
}
示例7: GoalMatrix
void CIKLimb::GoalMatrix(Matrix &M,SCalculateData* cd)
{
VERIFY(cd->m_tri&&cd->m_tri_hight!=-dInfinity);
const Fmatrix &obj=*cd->m_obj;
CDB::TRI *tri=cd->m_tri;
CKinematics *K=cd->m_K;
Fvector* pVerts = Level().ObjectSpace.GetStaticVerts();
Fvector normal;
normal.mknormal (pVerts[tri->verts[0]],pVerts[tri->verts[1]],pVerts[tri->verts[2]]);
VERIFY(!fis_zero(normal.magnitude()));
Fmatrix iobj;iobj.invert(obj);iobj.transform_dir(normal);
Fmatrix xm;xm.set(K->LL_GetTransform(m_bones[2]));
//Fvector dbg;
//dbg.set(Fvector().mul(normal,normal.y*tri_hight
// -normal.dotproduct(xm.i)*m_toe_position.x
// -normal.dotproduct(xm.j)*m_toe_position.y
// -normal.dotproduct(xm.k)*m_toe_position.z-m_toe_position.x
// ));
normal.invert();
Fvector ax;ax.crossproduct(normal,xm.i);
float s=ax.magnitude();
if(!fis_zero(s))
{
ax.mul(1.f/s);
xm.mulA_43(Fmatrix().rotation(ax,asinf(-s)));
}
Fvector otri;iobj.transform_tiny(otri,pVerts[tri->verts[0]]);
float tp=normal.dotproduct(otri);
Fvector add;
add.set(Fvector().mul(normal,-m_toe_position.x+tp-xm.c.dotproduct(normal)));
xm.c.add(add);
Fmatrix H;
CBoneData& bd=K->LL_GetData(m_bones[0]);
H.set(bd.bind_transform);
H.mulA_43(K->LL_GetTransform(bd.GetParentID()));
H.c.set(K->LL_GetTransform(m_bones[0]).c);
#ifdef DEBUG
if(ph_dbg_draw_mask.test(phDbgIKAnimGoalOnly)) xm.set(K->LL_GetTransform(m_bones[2]));
if(ph_dbg_draw_mask.test(phDbgDrawIKGoal))
{
Fmatrix DBGG;
DBGG.mul_43(obj,xm);
DBG_DrawMatrix(DBGG,0.2f);
DBGG.mul_43(obj,H);
DBG_DrawMatrix(DBGG,0.2f);
}
#endif
H.invert();
Fmatrix G;
G.mul_43(H,xm);
XM2IM(G,M);
}
示例8: GetFullTransformToWorld
void CSceneObject::GetFullTransformToWorld( Fmatrix& m )
{
m.set(_Transform());
}
示例9:
void CKinematicsAnimated::Bone_GetAnimPos(Fmatrix& pos,u16 id,u8 mask_channel, bool ignore_callbacks)
{
CBoneInstance bi = LL_GetBoneInstance(id);
BoneChain_Calculate(&LL_GetData(id),bi,mask_channel,ignore_callbacks);
pos.set(bi.mTransform);
}
示例10: ExportClimableObjects
bool ESceneObjectTool::ExportClimableObjects(SExportStreams* F)
{
bool bResult = true;
CGeomPartExtractor* extractor = 0;
Fbox bb;
if (!GetBox(bb))
return false;
extractor = xr_new<CGeomPartExtractor>();
extractor->Initialize (bb,EPS_L,int_max);
UI->SetStatus ("Export climable objects...");
// collect verts&&faces
{
SPBItem* pb = UI->ProgressStart(m_Objects.size(), "Prepare geometry...");
for (ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); it++)
{
pb->Inc();
CSceneObject* obj = dynamic_cast<CSceneObject*>(*it);
VERIFY (obj);
if (obj->IsStatic())
{
CEditableObject *O = obj->GetReference();
const Fmatrix& T = obj->_Transform();
for(EditMeshIt M =O->FirstMesh(); M!=O->LastMesh(); M++)
if (!build_mesh (T, *M, extractor, SGameMtl::flClimable, TRUE))
{
bResult = false;
break;
}
}
}
UI->ProgressEnd(pb);
}
if (!extractor->Process())
bResult = false;
// export parts
if (bResult)
{
SBPartVec& parts = extractor->GetParts();
SPBItem* pb = UI->ProgressStart(parts.size(),"Export Parts...");
for (SBPartVecIt p_it=parts.begin(); p_it!=parts.end(); p_it++)
{
pb->Inc ();
SBPart* P = *p_it;
if (P->Valid())
{
// export visual
AnsiString sn = AnsiString().sprintf("clmbl#%d",(p_it-parts.begin()));
Fvector local_normal = {0,0,0};
LPCSTR mat_name = NULL;
for (SBFaceVecIt it=P->m_Faces.begin(); it!=P->m_Faces.end(); it++)
{
for (u32 k=0; k<3; k++)
local_normal.add ((*it)->n[k]);
mat_name = (*it)->surf->_GameMtlName();
}
local_normal.normalize_safe ();
// export spawn object
{
AnsiString entity_ref = "climable_object";
ISE_Abstract* m_Data = create_entity(entity_ref.c_str()); VERIFY(m_Data);
ISE_Shape* m_Shape = m_Data->shape(); VERIFY(m_Shape);
// CSE_Visual* m_Visual = m_Data->visual(); VERIFY(m_Visual);
// set params
m_Data->set_name (entity_ref.c_str());
m_Data->set_name_replace (sn.c_str());
// set shape
CShapeData::shape_def shape;
shape.type = CShapeData::cfBox;
shape.data.box.scale ((P->m_BBox.max.x-P->m_BBox.min.x)*0.5f,
(P->m_BBox.max.y-P->m_BBox.min.y)*0.5f,
(P->m_BBox.max.z-P->m_BBox.min.z)*0.5f);
m_Shape->assign_shapes (&shape,1);
// orientate object
if (!OrientToNorm(local_normal,P->m_OBB.m_rotate,P->m_OBB.m_halfsize))
{
ELog.Msg(mtError,"Invalid climable object found. [%3.2f, %3.2f, %3.2f]",VPUSH(P->m_RefOffset));
}
else
{
Fmatrix M; M.set (P->m_OBB.m_rotate.i,P->m_OBB.m_rotate.j,P->m_OBB.m_rotate.k,P->m_OBB.m_translate);
M.getXYZ (P->m_RefRotate); // не i потому что в движке так
m_Data->position().set (P->m_RefOffset);
m_Data->angle().set (P->m_RefRotate);
m_Data->set_additional_info((void*)mat_name);
NET_Packet Packet;
m_Data->Spawn_Write (Packet,TRUE);
F->spawn.stream.open_chunk (F->spawn.chunk++);
F->spawn.stream.w (Packet.B.data,Packet.B.count);
//.........这里部分代码省略.........
示例11: NotificatePart
void CPHDestroyable::NotificatePart(CPHDestroyableNotificate *dn)
{
CPhysicsShell *own_shell=PPhysicsShellHolder()->PPhysicsShell() ;
CPhysicsShell *new_shell=dn->PPhysicsShellHolder()->PPhysicsShell() ;
IKinematics *own_K =smart_cast<IKinematics*>(PPhysicsShellHolder()->Visual());
IKinematics *new_K =smart_cast<IKinematics*>(dn->PPhysicsShellHolder()->Visual()) ;
VERIFY (own_K&&new_K&&own_shell&&new_shell) ;
CInifile *own_ini =own_K->LL_UserData() ;
CInifile *new_ini =new_K->LL_UserData() ;
//////////////////////////////////////////////////////////////////////////////////
Fmatrix own_transform;
own_shell ->GetGlobalTransformDynamic (&own_transform) ;
new_shell ->SetGlTransformDynamic (own_transform) ;
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
float random_min =1.f ;
float random_hit_imp =1.f ;
////////////////////////////////////////////////////////////////////////////////////
u16 ref_bone =own_K->LL_GetBoneRoot();
float imp_transition_factor =1.f ;
float lv_transition_factor =1.f ;
float av_transition_factor =1.f ;
////////////////////////////////////////////////////////////////////////////////////
if(own_ini&&own_ini->section_exist("impulse_transition_to_parts"))
{
random_min =own_ini->r_float("impulse_transition_to_parts","random_min");
random_hit_imp =own_ini->r_float("impulse_transition_to_parts","random_hit_imp");
////////////////////////////////////////////////////////
if(own_ini->line_exist("impulse_transition_to_parts","ref_bone"))
ref_bone =own_K->LL_BoneID(own_ini->r_string("impulse_transition_to_parts","ref_bone"));
imp_transition_factor =own_ini->r_float("impulse_transition_to_parts","imp_transition_factor");
lv_transition_factor =own_ini->r_float("impulse_transition_to_parts","lv_transition_factor");
av_transition_factor =own_ini->r_float("impulse_transition_to_parts","av_transition_factor");
if(own_ini->section_exist("collide_parts"))
{
if(own_ini->line_exist("collide_parts","small_object"))
{
new_shell->SetSmall();
}
if(own_ini->line_exist("collide_parts","ignore_small_objects"))
{
new_shell->SetIgnoreSmall();
}
}
}
if(new_ini&&new_ini->section_exist("impulse_transition_from_source_bone"))
{
//random_min =new_ini->r_float("impulse_transition_from_source_bone","random_min");
//random_hit_imp =new_ini->r_float("impulse_transition_from_source_bone","random_hit_imp");
////////////////////////////////////////////////////////
if(new_ini->line_exist("impulse_transition_from_source_bone","ref_bone"))
ref_bone =own_K->LL_BoneID(new_ini->r_string("impulse_transition_from_source_bone","ref_bone"));
imp_transition_factor =new_ini->r_float("impulse_transition_from_source_bone","imp_transition_factor");
lv_transition_factor =new_ini->r_float("impulse_transition_from_source_bone","lv_transition_factor");
av_transition_factor =new_ini->r_float("impulse_transition_from_source_bone","av_transition_factor");
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
dBodyID own_body=own_shell->get_Element(ref_bone)->get_body() ;
u16 new_el_number = new_shell->get_ElementsNumber() ;
for(u16 i=0;i<new_el_number;++i)
{
CPhysicsElement* e=new_shell->get_ElementByStoreOrder(i);
float random_hit=random_min*e->getMass();
if(m_fatal_hit.is_valide() && m_fatal_hit.bone()!=BI_NONE )
{
Fvector pos;
Fmatrix m;m.set(own_K->LL_GetTransform(m_fatal_hit.bone()));
m.mulA_43 (PPhysicsShellHolder()->XFORM());
m.transform_tiny(pos,m_fatal_hit.bone_space_position());
e->applyImpulseVsGF(pos,m_fatal_hit.direction(),m_fatal_hit.phys_impulse()*imp_transition_factor);
random_hit+=random_hit_imp*m_fatal_hit.phys_impulse();
}
Fvector rnd_dir;rnd_dir.random_dir();
e->applyImpulse(rnd_dir,random_hit);
Fvector mc; mc.set(e->mass_Center());
dVector3 res_lvell;
dBodyGetPointVel(own_body,mc.x,mc.y,mc.z,res_lvell);
cast_fv(res_lvell).mul(lv_transition_factor);
e->set_LinearVel(cast_fv(res_lvell));
Fvector res_avell;res_avell.set(cast_fv(dBodyGetAngularVel(own_body)));
res_avell.mul(av_transition_factor);
e->set_AngularVel(res_avell);
}
new_shell->Enable();
new_shell->EnableCollision();
dn->PPhysicsShellHolder()->setVisible(TRUE);
//.........这里部分代码省略.........
示例12: GetFullTransformToLocal
void CSceneObject::GetFullTransformToLocal( Fmatrix& m )
{
m.set(_ITransform());
}
示例13: set_toe
void CIKFoot::set_toe( u16 bones[4] )
{
VERIFY( Kinematics() );
m_foot_bone_id = bones[2];
m_toe_bone_id = bones[3];
xr_vector<Fmatrix> binds;
Kinematics()->LL_GetBindTransform( binds );
const Fmatrix bind_ref = binds[ bones[m_ref_bone] ];
const Fmatrix ibind_ref = Fmatrix().invert( bind_ref );
const Fmatrix bind2 = binds[ bones[2] ] ;
const Fmatrix ibind2 = Fmatrix().invert( bind2 );
//const Fmatrix ref_to_b2 = Fmatrix().mul_43( ibind2, bind_ref );
const Fmatrix b2to_ref = Fmatrix().mul_43( ibind_ref, bind2 );
const Fmatrix bind3 = binds[ bones[3] ] ;
const Fmatrix ibind3 = Fmatrix().invert( bind3 );
m_bind_b2_to_b3.mul_43( ibind2, bind3 );
///////////////////////////////////////////////////////
Fvector ax ,foot_normal, foot_dir;
get_local_vector( 2, foot_normal, m_foot_normal );
get_local_vector( 2, foot_dir, m_foot_direction );
//ref_to_b2.transform_tiny( foot_normal, m_foot_normal.v );
//ref_to_b2.transform_tiny( foot_dir, m_foot_direction.v );
ax.add( foot_normal, foot_dir );
ax.normalize();
///////////////////////////////////////////////////////
Fvector pos; pos.set( 0, 0, 0 );
Fmatrix ibind = ibind3;
envc pred( ibind, ax, pos );
/////////////////////////////////////////////////////////
Kinematics()->EnumBoneVertices( pred, bones[3] );
bind3.transform_tiny( pos );
ibind2.transform_tiny( pos );
m_toe_position.v.set( pos );
/////////////////////////////////////////////////////////
ibind.set( ibind2 );
ax.set( foot_normal );
Kinematics()->EnumBoneVertices( pred, bones[2] );
m_toe_position.v.x = _max( pos.x, m_toe_position.v.x );
/////////////////////////////////////////////////////////
ax.sub( foot_normal, foot_dir );
ax.normalize();
pred.start_pos.set(0,0,0);pos.set( 0, 0, 0 );
Kinematics()->EnumBoneVertices( pred, bones[2] );
m_heel_position.v = pred.pos ;
m_heel_position.v.add( Fvector().mul( foot_dir,
Fvector().sub( m_toe_position.v, pos ).dotproduct( foot_dir ) * 0.2f )
);
m_heel_position.bone = 2;
///////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
bind2.transform_tiny( m_toe_position.v );
ibind_ref.transform_tiny( m_toe_position.v );
m_toe_position.bone = ref_bone();
/////////////////////////////////////////////////////////
get_local_vector( foot_normal, m_foot_normal );
m_foot_width = ( Fvector().sub( m_toe_position.v, b2to_ref.c ) ).dotproduct( foot_normal );
}
示例14: GetFootStepMatrix
bool CIKFoot::GetFootStepMatrix( ik_goal_matrix &m, const Fmatrix &g_anim, const SIKCollideData &cld, bool collide, bool rotation, bool b_make_shift/*=true*/ )const
{
const Fmatrix global_anim = g_anim;
Fvector local_point; ToePosition( local_point ); //toe position in bone[2] space
Fvector global_point; global_anim.transform_tiny( global_point, local_point ); //non collided toe in global space
Fvector foot_normal; FootNormal( foot_normal );
global_anim.transform_dir( foot_normal );
#ifdef DEBUG
//if( ph_dbg_draw_mask.test( phDbgDrawIKGoal ) )
//{
// DBG_DrawLine( global_point, Fvector().add( global_point, foot_normal ), D3DCOLOR_XRGB( 0, 255, 255) );
//}
#endif
if( cld.m_collide_point == ik_foot_geom::heel || cld.m_collide_point == ik_foot_geom::side )
{
Fmatrix foot;ref_bone_to_foot( foot, g_anim );
Fvector heel;
HeelPosition( heel );
foot.transform_tiny(global_point, heel );
#ifdef DEBUG
if( ph_dbg_draw_mask.test( phDbgDrawIKGoal ) )
DBG_DrawPoint( global_point, 0.01, D3DCOLOR_XRGB( 0, 255, 255));
#endif
Fmatrix foot_to_ref;
ref_bone_to_foot_transform(foot_to_ref).transform_tiny(local_point, heel );
}
float dtoe_tri =-cld.m_plane.d - cld.m_plane.n.dotproduct( global_point );
if( !cld.collided || _abs( dtoe_tri ) > collide_dist )
{
m.set( global_anim, ik_goal_matrix::cl_free );
return false;
}
Fplane p = cld.m_plane;
Fmatrix xm; xm.set( global_anim );
ik_goal_matrix::e_collide_state cl_state = ik_goal_matrix::cl_undefined;
if( rotation )//!collide || ik_allign_free_foot
cl_state = rotate( xm, p, foot_normal, global_point, collide );
if( b_make_shift && make_shift( xm, local_point, collide, p, cld.m_pick_dir ) )
switch( cl_state )
{
case ik_goal_matrix::cl_aligned : break;
case ik_goal_matrix::cl_undefined :
case ik_goal_matrix::cl_free :
cl_state = ik_goal_matrix::cl_translational; break;
case ik_goal_matrix::cl_rotational:
cl_state = ik_goal_matrix::cl_mixed; break;
default: NODEFAULT;
}
else if( cl_state == ik_goal_matrix::cl_undefined )
cl_state = ik_goal_matrix::cl_free;
VERIFY( _valid( xm ) );
m.set( xm, cl_state );
#ifdef DEBUG
if(ph_dbg_draw_mask.test( phDbgDrawIKGoal ))
{
DBG_DrawPoint( global_point, 0.03f, D3DCOLOR_RGBA( 255, 0, 0, 255 ) );
}
if(!fsimilar( _abs( DET( g_anim ) - 1.f ), _abs( DET( m.get() ) - 1.f ), 0.001f ) )
Msg("scale g_anim: %f scale m: %f ", DET( g_anim ) , DET( m.get() ) );
#endif
return true;
}
示例15: UpdateCLChild
void CBastArtefact::UpdateCLChild()
{
//Log ("--- A - CBastArtefact",*cName());
//Log ("--- A - CBastArtefact",renderable.xform);
//современем энергия по немногу тоже уменьшается
if(m_fEnergy>0) m_fEnergy -= m_fEnergyDecreasePerTime*Device.fTimeDelta;
if (getVisible() && m_pPhysicsShell) {
if(m_bStrike) {
//выбрать жертву, если она еще не выбрана
if(!m_AliveList.empty() && m_AttakingEntity == NULL) {
CEntityAlive* pEntityToHit = NULL;
if(m_AliveList.size()>1)
{
do
{
int rnd = ::Random.randI(m_AliveList.size());
pEntityToHit = m_AliveList[rnd];
} while (pEntityToHit == m_pHitedEntity);
}
else
{
pEntityToHit = m_AliveList.front();
}
m_AttakingEntity = pEntityToHit;
}
}
if(m_AttakingEntity)
{
if(m_AttakingEntity->g_Alive() && m_fEnergy>m_fStrikeImpulse)
{
m_fEnergy -= m_fStrikeImpulse;
//бросить артефакт на выбранную цель
Fvector dir;
m_AttakingEntity->Center(dir);
dir.sub(this->Position());
dir.y += ::Random.randF(-0.05f, 0.5f);
m_pPhysicsShell->applyImpulse(dir,
m_fStrikeImpulse * Device.fTimeDelta *
m_pPhysicsShell->getMass());
}
else
{
m_AttakingEntity = NULL;
m_bStrike = false;
}
}
if(m_fEnergy>0 && ::Random.randF(0.f, 1.0f)<(m_fEnergy/(m_fStrikeImpulse*100.f)))
{
CParticlesObject* pStaticPG;
pStaticPG = CParticlesObject::Create(*m_sParticleName,TRUE);
Fmatrix pos;
pos.set(XFORM());
Fvector vel;
//vel.sub(Position(),ps_Element(0).vPosition);
//vel.div((Level().timeServer()-ps_Element(0).dwTime)/1000.f);
vel.set(0,0,0);
pStaticPG->UpdateParent(pos, vel);
pStaticPG->Play();
}
}
else if(H_Parent()) XFORM().set(H_Parent()->XFORM());
}