void walk (ISpatial_NODE* N, Fvector& n_C, float n_R, u32 fmask) { // box float n_vR = 2*n_R; Fbox BB; BB.set (n_C.x-n_vR, n_C.y-n_vR, n_C.z-n_vR, n_C.x+n_vR, n_C.y+n_vR, n_C.z+n_vR); if (fcvNone==F->testAABB(BB.data(),fmask)) return; // test items xr_vector<ISpatial*>::iterator _it = N->items.begin (); xr_vector<ISpatial*>::iterator _end = N->items.end (); for (; _it!=_end; _it++) { ISpatial* S = *_it; if (0==(S->spatial.type&mask)) continue; Fvector& sC = S->spatial.sphere.P; float sR = S->spatial.sphere.R; u32 tmask = fmask; if (fcvNone==F->testSphere(sC,sR,tmask)) continue; space->q_result->push_back (S); } // recurse float c_R = n_R/2; for (u32 octant=0; octant<8; octant++) { if (0==N->children[octant]) continue; Fvector c_C; c_C.mad (n_C,c_spatial_offset[octant],c_R); walk (N->children[octant],c_C,c_R,fmask); } }
float CBaseMonster::get_screen_space_coverage_diagonal() { Fbox b = Visual()->getVisData().box; Fmatrix xform; xform.mul (Device.mFullTransform,XFORM()); Fvector2 mn ={flt_max,flt_max},mx={flt_min,flt_min}; for (u32 k=0; k<8; ++k) { Fvector p; b.getpoint (k,p); xform.transform (p); mn.x = _min(mn.x,p.x); mn.y = _min(mn.y,p.y); mx.x = _max(mx.x,p.x); mx.y = _max(mx.y,p.y); } float const width = mx.x - mn.x; float const height = mx.y - mn.y; float const average_diagonal = _sqrt(width * height); return average_diagonal; }
void ESceneAIMapTool::CalculateNodesBBox(Fbox& bb) { bb.invalidate(); for (AINodeIt b_it=m_Nodes.begin(); b_it!=m_Nodes.end(); ++b_it) { VERIFY(_valid((*b_it)->Pos)); bb.modify((*b_it)->Pos); } }
IC void get_cam_oob( Fvector &bc, Fvector &bd, Fmatrix33 &mat, const Fmatrix &xform, const SRotation &r_torso, float alpha, float radius, float c ) { get_box_mat ( mat, alpha, r_torso ); Fbox xf; get_q_box( xf, c, alpha, radius ); xf.xform ( Fbox().set(xf), xform ) ; // query xf.get_CD (bc,bd) ; }
void CalculateRelSet(Fvector &pos, vecW &rel_set) { // calculate volume in local level space Fbox Volume; Volume.set(pos,pos); float Vsize = (g_params.m_relevance+g_params.m_sample_step)/2.f; Volume.min.sub(Vsize); Volume.max.add(Vsize); Volume.min.sub(g_TREE_ROOT->bbox.min); Volume.max.sub(g_TREE_ROOT->bbox.min); // scale it to sample grid space Volume.min.div(g_params.m_sample_step); Volume.max.div(g_params.m_sample_step); // calc volume in grid-space int minX,minY,minZ; int maxX,maxY,maxZ; minX = iROUND(floorf(Volume.min.x)); clamp(minX, 0, int(g_pvs_X)-1); minY = iROUND(floorf(Volume.min.y)); clamp(minY, 0, int(g_pvs_Y)-1); minZ = iROUND(floorf(Volume.min.z)); clamp(minZ, 0, int(g_pvs_Z)-1); maxX = iROUND(ceilf(Volume.max.x)); clamp(maxX, 0, int(g_pvs_X)-1); maxY = iROUND(ceilf(Volume.max.y)); clamp(maxY, 0, int(g_pvs_Y)-1); maxZ = iROUND(ceilf(Volume.max.z)); clamp(maxZ, 0, int(g_pvs_Z)-1); /* clMsg("- Selected BB: [%d,%d,%d]-[%d,%d,%d]", minX,minY,minZ, maxX,maxY,maxZ ); */ // merge data for (int z=minZ; z<=maxZ; z++) { for (int x=minX; x<=maxX; x++) { for (int y=minY; y<=maxY; y++) { u32 cell = z*g_pvs_X*g_pvs_Y + x*g_pvs_Y + y; // clMsg("* Sample #%d",cell); int ptr = g_pvs_map_vm[cell]; if (ptr>=0) { rel_set.insert(rel_set.end(),g_pvs[ptr].begin(),g_pvs[ptr].end()); } } } } if (rel_set.size()>1) { std::sort(rel_set.begin(),rel_set.end()); vecW_IT I = std::unique(rel_set.begin(),rel_set.end()); rel_set.erase(I,rel_set.end()); } }
void CPHMovementControl::Load (LPCSTR section){ //capture //strcpy(m_capture_bone,pSettings->r_string(section,"capture_bone")); Fbox bb; // m_PhysicMovementControl: BOX Fvector vBOX1_center= pSettings->r_fvector3 (section,"ph_box1_center" ); Fvector vBOX1_size = pSettings->r_fvector3 (section,"ph_box1_size" ); bb.set (vBOX1_center,vBOX1_center); bb.grow(vBOX1_size); SetBox (1,bb); // m_PhysicMovementControl: BOX Fvector vBOX0_center= pSettings->r_fvector3 (section,"ph_box0_center" ); Fvector vBOX0_size = pSettings->r_fvector3 (section,"ph_box0_size" ); bb.set (vBOX0_center,vBOX0_center); bb.grow(vBOX0_size); SetBox (0,bb); //// m_PhysicMovementControl: Foots //Fvector vFOOT_center= pSettings->r_fvector3 (section,"ph_foot_center" ); //Fvector vFOOT_size = pSettings->r_fvector3 (section,"ph_foot_size" ); //bb.set (vFOOT_center,vFOOT_center); bb.grow(vFOOT_size); //SetFoots (vFOOT_center,vFOOT_size); // m_PhysicMovementControl: Crash speed and mass float cs_min = pSettings->r_float (section,"ph_crash_speed_min" ); float cs_max = pSettings->r_float (section,"ph_crash_speed_max" ); float mass = pSettings->r_float (section,"ph_mass" ); xr_token retrictor_types[]={ { "actor", CPHCharacter::rtActor}, { "medium_monster", CPHCharacter::rtMonsterMedium}, { "stalker", CPHCharacter::rtStalker }, { "none", CPHCharacter::rtNone }, { 0, 0} }; if(pSettings->line_exist(section,"actor_restrictor")) SetRestrictionType(CPHCharacter::ERestrictionType(pSettings->r_token(section,"actor_restrictor",retrictor_types))); fCollisionDamageFactor=READ_IF_EXISTS(pSettings,r_float,section,"ph_collision_damage_factor",fCollisionDamageFactor); R_ASSERT3(fCollisionDamageFactor<=1.f,"ph_collision_damage_factor >1.",section); SetCrashSpeeds (cs_min,cs_max); SetMass (mass); // m_PhysicMovementControl: Frictions //float af, gf, wf; //af = pSettings->r_float (section,"ph_friction_air" ); //gf = pSettings->r_float (section,"ph_friction_ground"); //wf = pSettings->r_float (section,"ph_friction_wall" ); //SetFriction (af,wf,gf); // BOX activate // ActivateBox (0); }
bool ESceneObjectTools::GetBox (Fbox& bb) { bb.invalidate (); Fbox bbo; for (ObjectIt a_it=m_Objects.begin(); a_it!=m_Objects.end(); a_it++){ (*a_it)->GetBox (bbo); bb.merge (bbo); } return bb.is_valid(); }
void modify (const int &vertex_id, Fbox &bounding_box) { const CGameGraph &graph = ai().game_graph(); bounding_box.modify (graph.vertex(vertex_id)->game_point()); CGameGraph::const_iterator I,E; graph.begin (vertex_id,I,E); for ( ; I != E; ++I) bounding_box.modify (graph.vertex(graph.value(vertex_id,I))->game_point()); }
IC void get_q_box( Fbox &xf, float c, float alpha, float radius ) { Fvector src_pt, tgt_pt; calc_point (tgt_pt,radius,0,alpha); src_pt.set (0,tgt_pt.y,0); xf.invalidate (); xf.modify (src_pt); xf.modify (tgt_pt); xf.grow (c); }
int EScene::BoxQuery(SPickQuery& PQ, const Fbox& bb, u32 flags, CDB::MODEL* model) { PQ.prepare_bq (bb,flags); ETOOLS::box_options (flags); Fvector c,d; bb.getcenter (c); bb.getradius (d); ETOOLS::box_query (model,c,d); for (int r=0; r<ETOOLS::r_count(); r++) PQ.append (ETOOLS::r_begin()+r,0,0); return PQ.r_count(); }
void EDetailManager::UpdateSlotBBox(int sx, int sz, DetailSlot& slot) { Fbox bbox; Frect rect; GetSlotRect (rect,sx,sz); bbox.min.set (rect.x1, m_BBox.min.y, rect.y1); bbox.max.set (rect.x2, m_BBox.max.y, rect.y2); SBoxPickInfoVec pinf; ETOOLS::box_options(0); if (Scene->BoxPickObjects(bbox,pinf,&m_SnapObjects)){ bbox.grow (EPS_L_VAR); Fplane frustum_planes[4]; frustum_planes[0].build(bbox.min,left_vec); frustum_planes[1].build(bbox.min,back_vec); frustum_planes[2].build(bbox.max,right_vec); frustum_planes[3].build(bbox.max,fwd_vec); CFrustum frustum; frustum.CreateFromPlanes(frustum_planes,4); float y_min = flt_max; float y_max = flt_min; for (SBoxPickInfoIt it=pinf.begin(); it!=pinf.end(); it++){ for (int k=0; k<(int)it->inf.size(); k++){ float range; Fvector verts[3]; it->e_obj->GetFaceWorld(it->s_obj->_Transform(),it->e_mesh,it->inf[k].id,verts); sPoly sSrc (verts,3); sPoly sDest; sPoly* sRes = frustum.ClipPoly(sSrc, sDest); if (sRes){ for (u32 k=0; k<sRes->size(); k++){ float H = (*sRes)[k].y; if (H>y_max) y_max = H+0.03f; if (H<y_min) y_min = H-0.03f; } slot.w_y (y_min,y_max-y_min); slot.w_id(0,DetailSlot::ID_Empty); slot.w_id(1,DetailSlot::ID_Empty); slot.w_id(2,DetailSlot::ID_Empty); slot.w_id(3,DetailSlot::ID_Empty); } } } }else{ ZeroMemory(&slot,sizeof(DetailSlot)); slot.w_id(0,DetailSlot::ID_Empty); slot.w_id(1,DetailSlot::ID_Empty); slot.w_id(2,DetailSlot::ID_Empty); slot.w_id(3,DetailSlot::ID_Empty); } }
float CalculateHeight(Fbox& BB) { // All nodes BB.invalidate(); for (u32 i=0; i<g_nodes.size(); i++) { vertex& N = g_nodes[i]; BB.modify (N.Pos); } return BB.max.y-BB.min.y+EPS_L; }
void ESceneLightTools::SelectLightsForObject(CCustomObject* obj) { for (u32 i=0; i<frame_light.size(); i++){ CLight* l = frame_light[i]; // if (obj->IsDynamic()&&!l->m_Flags.is(CLight::flAffectDynamic)) continue; // if (!obj->IsDynamic()&&!l->m_Flags.is(CLight::flAffectStatic)) continue; Fbox bb; obj->GetBox(bb); Fvector C; float R; bb.getsphere(C,R); float d = C.distance_to(l->PPosition) - l->m_Range - R; Device.LightEnable(i,(d<0)); } }
bool CGroupObject::FrustumPick(const CFrustum& frustum) { if (m_Objects.empty()){ Fbox bb; GetBox (bb); u32 mask = u32(-1); return (frustum.testAABB(bb.data(),mask)); }else{ for (ObjectIt it=m_Objects.begin(); it!=m_Objects.end(); it++) if ((*it)->FrustumPick(frustum)) return true; } return false; }
void CEditableObject::UpdateBox(){ VERIFY(!m_Meshes.empty()); EditMeshIt m = m_Meshes.begin(); m_Box.invalidate(); for(;m!=m_Meshes.end();m++){ Fbox meshbox; (*m)->GetBox(meshbox); for(int i=0; i<8; i++){ Fvector pt; meshbox.getpoint(i, pt); m_Box.modify(pt); } } }
void CDrawUtilities::OnDeviceCreate() { Device.seqRender.Add (this,REG_PRIORITY_LOW-1000); m_SolidBox.CreateFromData (D3DPT_TRIANGLELIST,DU_BOX_NUMFACES, D3DFVF_XYZ|D3DFVF_DIFFUSE,du_box_vertices, DU_BOX_NUMVERTEX, du_box_faces, DU_BOX_NUMFACES*3); m_SolidCone.CreateFromData (D3DPT_TRIANGLELIST,DU_CONE_NUMFACES, D3DFVF_XYZ|D3DFVF_DIFFUSE,du_cone_vertices, DU_CONE_NUMVERTEX, du_cone_faces, DU_CONE_NUMFACES*3); m_SolidSphere.CreateFromData (D3DPT_TRIANGLELIST,DU_SPHERE_NUMFACES, D3DFVF_XYZ|D3DFVF_DIFFUSE,du_sphere_vertices, DU_SPHERE_NUMVERTEX, du_sphere_faces, DU_SPHERE_NUMFACES*3); m_SolidSpherePart.CreateFromData(D3DPT_TRIANGLELIST,DU_SPHERE_PART_NUMFACES,D3DFVF_XYZ|D3DFVF_DIFFUSE,du_sphere_part_vertices, DU_SPHERE_PART_NUMVERTEX, du_sphere_part_faces, DU_SPHERE_PART_NUMFACES*3); m_SolidCylinder.CreateFromData (D3DPT_TRIANGLELIST,DU_CYLINDER_NUMFACES, D3DFVF_XYZ|D3DFVF_DIFFUSE,du_cylinder_vertices, DU_CYLINDER_NUMVERTEX, du_cylinder_faces, DU_CYLINDER_NUMFACES*3); m_WireBox.CreateFromData (D3DPT_LINELIST, DU_BOX_NUMLINES, D3DFVF_XYZ|D3DFVF_DIFFUSE,du_box_vertices, DU_BOX_NUMVERTEX, du_box_lines, DU_BOX_NUMLINES*2); m_WireCone.CreateFromData (D3DPT_LINELIST, DU_CONE_NUMLINES, D3DFVF_XYZ|D3DFVF_DIFFUSE,du_cone_vertices, DU_CONE_NUMVERTEX, du_cone_lines, DU_CONE_NUMLINES*2); m_WireSphere.CreateFromData (D3DPT_LINELIST, DU_SPHERE_NUMLINES, D3DFVF_XYZ|D3DFVF_DIFFUSE,du_sphere_verticesl, DU_SPHERE_NUMVERTEXL, du_sphere_lines, DU_SPHERE_NUMLINES*2); m_WireSpherePart.CreateFromData (D3DPT_LINELIST, DU_SPHERE_PART_NUMLINES,D3DFVF_XYZ|D3DFVF_DIFFUSE,du_sphere_part_vertices, DU_SPHERE_PART_NUMVERTEX, du_sphere_part_lines, DU_SPHERE_PART_NUMLINES*2); m_WireCylinder.CreateFromData (D3DPT_LINELIST, DU_CYLINDER_NUMLINES, D3DFVF_XYZ|D3DFVF_DIFFUSE,du_cylinder_vertices, DU_CYLINDER_NUMVERTEX, du_cylinder_lines, DU_CYLINDER_NUMLINES*2); for(int i=0;i<LINE_DIVISION;i++){ float angle = M_PI * 2.f * (i / (float)LINE_DIVISION); float _sa=_sin(angle), _ca=_cos(angle); circledef1[i].x = _ca; circledef1[i].y = _sa; circledef1[i].z = 0; circledef2[i].x = 0; circledef2[i].y = _ca; circledef2[i].z = _sa; circledef3[i].x = _sa; circledef3[i].y = 0; circledef3[i].z = _ca; } // initialize identity box Fbox bb; bb.set(-0.505f,-0.505f,-0.505f, 0.505f,0.505f,0.505f); for (i=0; i<8; i++){ Fvector S; Fvector p; bb.getpoint(i,p); S.set((float)SIGN(p.x),(float)SIGN(p.y),(float)SIGN(p.z)); boxvert[i*6+0].set(p); boxvert[i*6+1].set(p.x-S.x*0.25f,p.y,p.z); boxvert[i*6+2].set(p); boxvert[i*6+3].set(p.x,p.y-S.y*0.25f,p.z); boxvert[i*6+4].set(p); boxvert[i*6+5].set(p.x,p.y,p.z-S.z*0.25f); } // create render stream vs_L.create (FVF::F_L,RCache.Vertex.Buffer(),RCache.Index.Buffer()); vs_TL.create (FVF::F_TL,RCache.Vertex.Buffer(),RCache.Index.Buffer()); vs_LIT.create (FVF::F_LIT,RCache.Vertex.Buffer(),RCache.Index.Buffer()); m_Font = new CGameFont("stat_font"); }
IC BOOL ValidateMerge (Fbox& bb_base, Fbox& bb, float& volume, float SLimit) { // Size Fbox merge; merge.merge (bb_base,bb); Fvector sz; merge.getsize (sz); sz.add (EPS_L); if (sz.x>SLimit) return FALSE; // Don't exceed limits (4/3 GEOM) if (sz.y>SLimit) return FALSE; if (sz.z>SLimit) return FALSE; // Volume volume = merge.getvolume (); // OK return TRUE; }
bool ESoundSource::GetBox( Fbox& box ) { box.set( m_Params.position, m_Params.position ); box.min.sub(m_Params.max_distance); box.max.add(m_Params.max_distance); return true; }
bool CGlow::GetBox( Fbox& box ) { box.set( PPosition, PPosition ); box.min.sub(m_fRadius); box.max.add(m_fRadius); return true; }
void ESceneAIMapTool::GetBBox(Fbox& bb, bool bSelOnly) { switch (LTools->GetSubTarget()){ case estAIMapNode:{ if (bSelOnly){ for (AINodeIt it=m_Nodes.begin(); it!=m_Nodes.end(); it++) if ((*it)->flags.is(SAINode::flSelected)){ bb.modify(Fvector().add((*it)->Pos,-m_Params.fPatchSize*0.5f)); bb.modify(Fvector().add((*it)->Pos,m_Params.fPatchSize*0.5f)); } }else{ bb.merge (m_AIBBox); } }break; } }
bool CLight::GetBox( Fbox& box ) { box.set (PPosition, PPosition); box.min.sub (m_Range); box.max.add (m_Range); return true; }
void ComputeSphere(Fsphere &B, FvectorVec& V) { if (V.size()<3) { B.P.set(0,0,0); B.R=0.f; return; } // 1: calc first variation Fsphere S1; Fsphere_compute (S1,V.begin(),V.size()); BOOL B1 = SphereValid(V,S1); // 2: calc ordinary algorithm (2nd) Fsphere S2; Fbox bbox; bbox.invalidate (); for (FvectorIt I=V.begin(); I!=V.end(); I++) bbox.modify(*I); bbox.grow (EPS_L); bbox.getsphere (S2.P,S2.R); S2.R = -1; for (I=V.begin(); I!=V.end(); I++) { float d = S2.P.distance_to_sqr(*I); if (d>S2.R) S2.R=d; } S2.R = _sqrt (_abs(S2.R)); BOOL B2 = SphereValid(V,S2); // 3: calc magic-fm Mgc::Sphere _S3 = Mgc::MinSphere(V.size(), (const Mgc::Vector3*) V.begin()); Fsphere S3; S3.P.set (_S3.Center().x,_S3.Center().y,_S3.Center().z); S3.R = _S3.Radius(); BOOL B3 = SphereValid(V,S3); // select best one if (B1 && (S1.R<S2.R)){ // miniball or FM if (B3 && (S3.R<S1.R)){ // FM wins B.set (S3); }else{ // MiniBall wins B.set (S1); } }else{ // base or FM if (B3 && (S3.R<S2.R)){ // FM wins B.set (S3); }else{ // Base wins :) R_ASSERT(B2); B.set (S2); } } }
bool CEditShape::GetBox(Fbox& box) { if (m_Box.is_valid()){ box.xform(m_Box,FTransform); return true; } return false; }
bool CEditShape::RayPick(float& distance, const Fvector& start, const Fvector& direction, SRayPickInfo* pinf) { float dist = distance; for (ShapeIt it=shapes.begin(); it!=shapes.end(); it++){ switch (it->type){ case cfSphere:{ Fvector S,D; Fmatrix M; M.invert (FTransformR); M.transform_dir (D,direction); FITransform.transform_tiny(S,start); Fsphere& T = it->data.sphere; float bk_r = T.R; // T.R = FScale.x; T.intersect (S,D,dist); if (dist<=0.f) dist = distance; T.R = bk_r; }break; case cfBox:{ Fbox box; box.identity (); Fmatrix BI; BI.invert (it->data.box); Fvector S,D,S1,D1,P; FITransform.transform_tiny (S,start); FITransform.transform_dir (D,direction); BI.transform_tiny (S1,S); BI.transform_dir (D1,D); Fbox::ERP_Result rp_res = box.Pick2(S1,D1,P); if (rp_res==Fbox::rpOriginOutside){ it->data.box.transform_tiny (P); FTransform.transform_tiny (P); P.sub (start); dist = P.magnitude(); } }break; } } if (dist<distance){ distance = dist; return true; } return false; }
IC void BoxQuery(Fbox& BB, bool exact) { if (exact) XRC.box_options (CDB::OPT_FULL_TEST); else XRC.box_options (0); Fvector C,D; BB.get_CD (C,D); XRC.box_query (&Level,C,D); }
void setup_bbs (Fbox& b1, Fbox& b2, Fbox& bb,int edge) { Fvector size; b1.set (bb); b2.set(bb); size.sub(bb.max,bb.min); switch (edge) { case 0: b1.max.x -= size.x/2; b2.min.x += size.x/2; break; case 1: b1.max.y -= size.y/2; b2.min.y += size.y/2; break; case 2: b1.max.z -= size.z/2; b2.min.z += size.z/2; break; } };
bool CLevelTool::GetSelectionPosition(Fmatrix& result) { if(pCurTool) { Fvector center; Fbox BB; BB.invalidate (); // pCurTool->GetBBox (BB, true); const CCustomObject* object = pCurTool->LastSelected(); if(!object) return false; object->GetBox (BB); BB.getcenter (center); center.y = BB.max.y; Fvector2 pt_ss; pt_ss.set (10000,-10000); Fvector pt_ss_3d; BB.setb (center, Fvector().set(1.0f,1.0f,1.0f)); for(int k=0;k<8;++k) { Fvector pt; BB.getpoint(k,pt); EDevice.mFullTransform.transform(pt_ss_3d, pt); pt_ss.x = _min(pt_ss.x, pt_ss_3d.y); pt_ss.y = _max(pt_ss.y, pt_ss_3d.y); } float r_bb_ss = pt_ss.y - pt_ss.x; clamp(r_bb_ss, 0.0f,0.10f); float des_radius = 0.2f; float csale = des_radius/r_bb_ss; result.scale (csale,csale,csale); result.c = center; return true; }else return false; }
bool CCharacterPhysicsSupport::CollisionCorrectObjPos(const Fvector& start_from,bool character_create/*=false*/) { //Fvector shift;shift.sub( start_from, m_EntityAlife.Position() ); Fvector shift;shift.set(0,0,0); Fbox box; if(character_create) box.set( movement()->Box() ); else { if(m_pPhysicsShell) { VERIFY(m_pPhysicsShell->isFullActive()); Fvector sz,c; get_box( m_pPhysicsShell, mXFORM, sz, c ); box.setb( Fvector().sub( c, m_EntityAlife.Position() ), Fvector(sz).mul(0.5f) ); m_pPhysicsShell->DisableCollision(); }else box.set( m_EntityAlife.BoundingBox() ); } Fvector vbox;Fvector activation_pos; box.get_CD(activation_pos,vbox); shift.add(activation_pos); vbox.mul(2.f); activation_pos.add(shift,m_EntityAlife.Position()); CPHActivationShape activation_shape; activation_shape.Create(activation_pos,vbox,&m_EntityAlife); if( !DoCharacterShellCollide() && !character_create ) { CPHCollideValidator::SetCharacterClassNotCollide(activation_shape); } if( !character_create ) activation_shape.set_rotation( mXFORM ); bool ret = activation_shape.Activate(vbox,1,1.f,M_PI/8.f); m_EntityAlife.Position().sub(activation_shape.Position(),shift); activation_shape.Destroy(); if(m_pPhysicsShell) m_pPhysicsShell->EnableCollision(); return ret; }
void CCharacterPhysicsSupport::CollisionCorrectObjPos(const Fvector& start_from,bool character_create/*=false*/) { Fvector shift;shift.sub(start_from,m_EntityAlife.Position()); Fbox box; if(character_create)box.set(movement()->Box()); else box.set(m_EntityAlife.BoundingBox()); Fvector vbox;Fvector activation_pos; box.get_CD(activation_pos,vbox);shift.add(activation_pos);vbox.mul(2.f); activation_pos.add(shift,m_EntityAlife.Position()); CPHActivationShape activation_shape; activation_shape.Create(activation_pos,vbox,&m_EntityAlife); if(!DoCharacterShellCollide()&&!character_create) { CPHCollideValidator::SetCharacterClassNotCollide(activation_shape); } activation_shape.Activate(vbox,1,1.f,M_PI/8.f); m_EntityAlife.Position().sub(activation_shape.Position(),shift); activation_shape.Destroy(); }
bool EParticlesObject::GetBox( Fbox& box ) { box.set( PPosition, PPosition ); box.min.x -= PSOBJECT_SIZE; box.min.y -= PSOBJECT_SIZE; box.min.z -= PSOBJECT_SIZE; box.max.x += PSOBJECT_SIZE; box.max.y += PSOBJECT_SIZE; box.max.z += PSOBJECT_SIZE; return true; }