Exemplo n.º 1
0
void CPHObject::UnFreezeContent()
{
	R_ASSERT(m_flags.test(st_freezed));
	m_flags.set(st_freezed,FALSE);
	m_flags.set(st_activated,TRUE);
	vis_update_activate();
}
Exemplo n.º 2
0
void CPHShell::Deactivate(){

#ifdef ANIMATED_PHYSICS_OBJECT_SUPPORT
	if (m_pPhysicsShellAnimatorC)
	{
		xr_delete<CPhysicsShellAnimator>(m_pPhysicsShellAnimatorC); 
	}
#endif

	if(!isActive())return;
	R_ASSERT2(!ph_world->Processing(),"can not deactivate physics shell during physics processing!!!");
	R_ASSERT2(!ph_world->IsFreezed(),"can not deactivate physics shell when ph world is freezed!!!");
	R_ASSERT2(!CPHObject::IsFreezed(),"can not deactivate freezed !!!");
	ZeroCallbacks();
	VERIFY(ph_world&&ph_world->Exist());
	if(isFullActive())
	{
		vis_update_deactivate();
		CPHObject::activate();
		ph_world->Freeze();
		CPHObject::UnFreeze();
		ph_world->StepTouch();
		ph_world->UnFreeze();
		//Fmatrix m;
		//InterpolateGlobalTransform(&m);
	}
	spatial_unregister();
	
	vis_update_activate();
	//if(ref_object && !CPHObject::is_active() && m_active_count == 0)
	//{
	//	ref_object->processing_activate();
	//}
	DisableObject();
	CPHObject::remove_from_recently_deactivated();
	

	ELEMENT_I i;
	for(i=elements.begin();elements.end() != i;++i)
		(*i)->Deactivate();

	JOINT_I j;
	for(j=joints.begin();joints.end() != j;++j)
		(*j)->Deactivate();

	

	if(m_space) {
		dSpaceDestroy(m_space);
		m_space=NULL;
	}
	//bActive=false;
	//bActivating=false;
	m_flags.set(flActivating,FALSE);
	m_flags.set(flActive,FALSE);
	m_traced_geoms.clear();
	CPHObject::UnsetRayMotions();
}
Exemplo n.º 3
0
void CPHObject::activate()
{
	R_ASSERT2(dSpacedGeom(),"trying to activate destroyed or not created object!");
	if(m_flags.test(st_activated))return;
	if(m_flags.test(st_freezed))	{UnFreeze();return;}
	if(m_flags.test(st_recently_deactivated))remove_from_recently_deactivated();
	ph_world->AddObject(this);
	vis_update_activate();
	m_flags.set(st_activated,TRUE);
}