| 234 | } |
| 235 | |
| 236 | void CPHShell::Deactivate() |
| 237 | { |
| 238 | #ifdef ANIMATED_PHYSICS_OBJECT_SUPPORT |
| 239 | if (m_pPhysicsShellAnimatorC) |
| 240 | { |
| 241 | xr_delete(m_pPhysicsShellAnimatorC); |
| 242 | } |
| 243 | #endif |
| 244 | |
| 245 | if (!isActive()) |
| 246 | return; |
| 247 | R_ASSERT2(!ph_world->Processing(), "can not deactivate physics shell during physics processing!!!"); |
| 248 | R_ASSERT2(!ph_world->IsFreezed(), "can not deactivate physics shell when ph world is freezed!!!"); |
| 249 | R_ASSERT2(!CPHObject::IsFreezed(), "can not deactivate freezed !!!"); |
| 250 | ZeroCallbacks(); |
| 251 | VERIFY(ph_world && ph_world->Exist()); |
| 252 | if (isFullActive()) |
| 253 | { |
| 254 | vis_update_deactivate(); |
| 255 | CPHObject::activate(); |
| 256 | ph_world->Freeze(); |
| 257 | CPHObject::UnFreeze(); |
| 258 | ph_world->StepTouch(); |
| 259 | ph_world->UnFreeze(); |
| 260 | // Fmatrix m; |
| 261 | // InterpolateGlobalTransform(&m); |
| 262 | } |
| 263 | spatial_unregister(); |
| 264 | |
| 265 | vis_update_activate(); |
| 266 | // if(ref_object && !CPHObject::is_active() && m_active_count == 0) |
| 267 | //{ |
| 268 | // ref_object->processing_activate(); |
| 269 | // } |
| 270 | DisableObject(); |
| 271 | CPHObject::remove_from_recently_deactivated(); |
| 272 | |
| 273 | ELEMENT_I i; |
| 274 | for (i = elements.begin(); elements.end() != i; ++i) |
| 275 | (*i)->Deactivate(); |
| 276 | |
| 277 | JOINT_I j; |
| 278 | for (j = joints.begin(); joints.end() != j; ++j) |
| 279 | (*j)->Deactivate(); |
| 280 | |
| 281 | if (m_space) |
| 282 | { |
| 283 | dSpaceDestroy(m_space); |
| 284 | m_space = NULL; |
| 285 | } |
| 286 | // bActive=false; |
| 287 | // bActivating=false; |
| 288 | m_flags.set(flActivating, FALSE); |
| 289 | m_flags.set(flActive, FALSE); |
| 290 | m_traced_geoms.clear(); |
| 291 | CPHObject::UnsetRayMotions(); |
| 292 | } |