| 33 | E->m_flags.set(CPHElement::flActive, ac_state); |
| 34 | } |
| 35 | element_fracture CPHFracturesHolder::SplitFromEnd(CPHElement* element, u16 fracture) |
| 36 | { |
| 37 | FRACTURE_I fract_i = m_fractures.begin() + fracture; |
| 38 | u16 geom_num = fract_i->m_start_geom_num; |
| 39 | u16 end_geom_num = fract_i->m_end_geom_num; |
| 40 | SubFractureMass(fracture); |
| 41 | |
| 42 | CPHElement* new_element = cast_PHElement(P_create_Element()); |
| 43 | new_element->m_SelfID = fract_i->m_bone_id; |
| 44 | new_element->mXFORM.set(element->mXFORM); |
| 45 | element->PassEndGeoms(geom_num, end_geom_num, new_element); |
| 46 | ///////////////////////////////////////////// |
| 47 | IKinematics* pKinematics = element->m_shell->PKinematics(); |
| 48 | const CBoneInstance& new_bi = pKinematics->LL_GetBoneInstance(new_element->m_SelfID); |
| 49 | const CBoneInstance& old_bi = pKinematics->LL_GetBoneInstance(element->m_SelfID); |
| 50 | |
| 51 | Fmatrix shift_pivot; |
| 52 | shift_pivot.set(new_bi.mTransform); |
| 53 | shift_pivot.invert(); |
| 54 | shift_pivot.mulB_43(old_bi.mTransform); |
| 55 | ///////////////////////////////////////////// |
| 56 | float density = element->getDensity(); |
| 57 | new_element->SetShell(element->PHShell()); |
| 58 | Fmatrix current_transtform; |
| 59 | element->GetGlobalTransformDynamic(¤t_transtform); |
| 60 | InitNewElement(new_element, shift_pivot, density); |
| 61 | Fmatrix shell_form; |
| 62 | element->PHShell()->GetGlobalTransformDynamic(&shell_form); |
| 63 | current_transtform.mulA_43(shell_form); |
| 64 | new_element->SetTransform(current_transtform); |
| 65 | |
| 66 | // dBodyID new_element_body=new_element->get_body(); |
| 67 | // dBodyAddForce(new_element_body,fract_i->m_pos_in_element[0], |
| 68 | // fract_i->m_pos_in_element[1], |
| 69 | // fract_i->m_pos_in_element[2]); |
| 70 | ApplyImpactsToElement(new_element); |
| 71 | |
| 72 | // dBodyAddTorque(new_element->get_body(),fract_i->m_break_force, |
| 73 | // fract_i->m_break_torque, |
| 74 | // fract_i->m_add_torque_z); |
| 75 | // BodyCutForce(new_element_body,default_l_limit,default_w_limit); |
| 76 | element_fracture ret = mk_pair(new_element, (CShellSplitInfo)(*fract_i)); |
| 77 | |
| 78 | if (m_fractures.size() - fracture > 0) |
| 79 | { |
| 80 | if (new_element->m_fratures_holder == NULL) // create fractures holder if it was not created before |
| 81 | { |
| 82 | new_element->m_fratures_holder = xr_new<CPHFracturesHolder>(); |
| 83 | } |
| 84 | PassEndFractures(fracture, new_element); |
| 85 | } |
| 86 | |
| 87 | return ret; |
| 88 | } |
| 89 | |
| 90 | void CPHFracturesHolder::PassEndFractures(u16 from, CPHElement* dest) |
| 91 | { |
nothing calls this directly
no test coverage detected