| 135 | } |
| 136 | |
| 137 | void CCustomRocket::create_physic_shell() |
| 138 | { |
| 139 | VERIFY(!m_pPhysicsShell); |
| 140 | Fobb obb; |
| 141 | Visual()->getVisData().box.get_CD(obb.m_translate, obb.m_halfsize); |
| 142 | obb.m_rotate.identity(); |
| 143 | |
| 144 | // Physics (Elements) |
| 145 | CPhysicsElement* E = P_create_Element(); |
| 146 | R_ASSERT(E); |
| 147 | |
| 148 | Fvector ax; |
| 149 | float radius; |
| 150 | CHOOSE_MAX(obb.m_halfsize.x, ax.set(obb.m_rotate.i); ax.mul(obb.m_halfsize.x); radius = _min(obb.m_halfsize.y, obb.m_halfsize.z); obb.m_halfsize.y /= 2.f; |
| 151 | obb.m_halfsize.z /= 2.f, obb.m_halfsize.y, ax.set(obb.m_rotate.j); ax.mul(obb.m_halfsize.y); radius = _min(obb.m_halfsize.x, obb.m_halfsize.z); |
| 152 | obb.m_halfsize.x /= 2.f; obb.m_halfsize.z /= 2.f, obb.m_halfsize.z, ax.set(obb.m_rotate.k); ax.mul(obb.m_halfsize.z); |
| 153 | radius = _min(obb.m_halfsize.y, obb.m_halfsize.x); obb.m_halfsize.y /= 2.f; obb.m_halfsize.x /= 2.f) |
| 154 | // radius*=1.4142f; |
| 155 | Fsphere sphere1, sphere2; |
| 156 | sphere1.P.add(obb.m_translate, ax); |
| 157 | sphere1.R = radius * 1.4142f; |
| 158 | |
| 159 | sphere2.P.sub(obb.m_translate, ax); |
| 160 | sphere2.R = radius / 2.f; |
| 161 | |
| 162 | E->add_Box(obb); |
| 163 | E->add_Sphere(sphere1); |
| 164 | E->add_Sphere(sphere2); |
| 165 | |
| 166 | // Physics (Shell) |
| 167 | m_pPhysicsShell = P_create_Shell(); |
| 168 | R_ASSERT(m_pPhysicsShell); |
| 169 | m_pPhysicsShell->add_Element(E); |
| 170 | m_pPhysicsShell->setMass(7.f); |
| 171 | m_pPhysicsShell->SetAirResistance(); |
| 172 | } |
| 173 | |
| 174 | ////////////////////////////////////////////////////////////////////////// |
| 175 | // Rocket specific functions |
nothing calls this directly
no test coverage detected