Esempio n. 1
0
void CPHShell::activate(bool disable)
{
	PresetActive();
	if(!CPHObject::is_active()) vis_update_deactivate();
	if(!disable)EnableObject(0);

}
Esempio n. 2
0
void CPHObject::FreezeContent()
{
	R_ASSERT(!m_flags.test(st_freezed));
	m_flags.set(st_freezed,TRUE);
	m_flags.set(st_activated,FALSE);
	vis_update_deactivate();
}
Esempio n. 3
0
void CPHObject::deactivate()
{
	if(!m_flags.test(st_activated))return;
	VERIFY2(m_island.IsActive(),"can not do it during processing");
	ph_world->RemoveObject(PH_OBJECT_I(this));
	vis_update_deactivate();
	m_flags.set(st_activated,FALSE);
}
Esempio n. 4
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();
}
Esempio n. 5
0
void CPHShell::PureActivate()
{
	if(isActive())	return;
	//bActive=true;
	m_flags.set(flActive,TRUE);
	if(!CPHObject::is_active()) vis_update_deactivate();
	EnableObject(0);
	m_object_in_root.identity();
	spatial_register();
}
Esempio n. 6
0
void CPHShell::RunSimulation(bool place_current_forms/*true*/)
{
	if(!CPHObject::is_active()) vis_update_deactivate();
	EnableObject(0);


	dSpaceSetCleanup(m_space,0);

	{		
		ELEMENT_I i=elements.begin(),e=elements.end();
		if(place_current_forms) for(;i!=e;++i)(*i)->RunSimulation(mXFORM);
	}
	{
		JOINT_I i=joints.begin(),e=joints.end();
		for(;i!=e;++i) (*i)->RunSimulation();
	}	

	spatial_register();
}