Esempio n. 1
0
 void imotion_position::force_calculate_bones( IKinematicsAnimated& KA )
{
	IKinematics *K = shell->PKinematics();
	VERIFY( K );
	VERIFY( K == smart_cast<IKinematics *>( &KA ) );
	disable_bone_calculation( *K, false );

	K->Bone_Calculate( &K->LL_GetData(0), &Fidentity );

	if( saved_visual_callback )
	{
		u16 sv_root = K->LL_GetBoneRoot();
		K->LL_SetBoneRoot( 0 );
		saved_visual_callback( K );
		K->LL_SetBoneRoot( sv_root );
	}
	disable_bone_calculation( *K, true );
}
Esempio n. 2
0
void CPHSkeleton::RespawnInit()
{
	IKinematics*	K	=	smart_cast<IKinematics*>(PPhysicsShellHolder()->Visual());
	if(K)
	{
		K->LL_SetBoneRoot(0);
		K->LL_SetBonesVisible(0xffffffffffffffffL);
		K->CalculateBones_Invalidate();
		K->CalculateBones(TRUE);
	}
	Init();
	ClearUnsplited();
}
Esempio n. 3
0
bool CPHSkeleton::Spawn(CSE_Abstract *D)
{
	
	CSE_PHSkeleton *po		= smart_cast<CSE_PHSkeleton*>(D);
	VERIFY					(po);

	m_flags					= po->_flags;
	CSE_Visual				*visual = smart_cast<CSE_Visual*>(D);
	VERIFY					(visual);
	m_startup_anim			= visual->startup_animation;

	if(po->_flags.test(CSE_PHSkeleton::flSpawnCopy))
	{
		CPHSkeleton* source=smart_cast<CPHSkeleton*>(Level().Objects.net_Find(po->source_id));
		R_ASSERT2(source,"no source");
		source->UnsplitSingle(this);
		m_flags.set				(CSE_PHSkeleton::flSpawnCopy,FALSE);
		po->_flags.set				(CSE_PHSkeleton::flSpawnCopy,FALSE);
		po->source_id				=BI_NONE;
		return true;
	}
	else 
	{
		CPhysicsShellHolder	*obj	=	PPhysicsShellHolder();
		IKinematics			*K		=	NULL;
		if (obj->Visual())
		{
			K= smart_cast<IKinematics*>(obj->Visual());
			if(K)
			{
				K->LL_SetBoneRoot(po->saved_bones.root_bone);
				K->LL_SetBonesVisible(po->saved_bones.bones_mask);
			}
		}
		SpawnInitPhysics(D);
		RestoreNetState(po);
		if(obj->PPhysicsShell()&&obj->PPhysicsShell()->isFullActive())
			obj->PPhysicsShell()->GetGlobalTransformDynamic(&obj->XFORM());
		
		CPHDestroyableNotificate::spawn_notificate(D);

		if(K)
		{
			CInifile* ini=K->LL_UserData();
			if(ini&&ini->section_exist("collide"))
			{
				if(ini->line_exist("collide","not_collide_parts"))
				{
					CGID gr= CPHCollideValidator::RegisterGroup();
					obj->PPhysicsShell()->RegisterToCLGroup(gr);
				}
			}
			if(ini&&ini->section_exist("collide_parts"))
			{
				if(ini->line_exist("collide_parts","small_object"))
				{
					obj->PPhysicsShell()->SetSmall();
				}
				if(ini->line_exist("collide_parts","ignore_small_objects"))
				{
					obj->PPhysicsShell()->SetIgnoreSmall();
				}
			}
		}
	}
	return false;
}