本文整理汇总了C++中CCopyEntity::CopyParentPose方法的典型用法代码示例。如果您正苦于以下问题:C++ CCopyEntity::CopyParentPose方法的具体用法?C++ CCopyEntity::CopyParentPose怎么用?C++ CCopyEntity::CopyParentPose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCopyEntity
的用法示例。
在下文中一共展示了CCopyEntity::CopyParentPose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdatePhysics
void EntityManager::UpdatePhysics( float frametime )
{
PROFILE_FUNCTION();
// frametime *= 0.5f;
Scalar total_time = frametime + m_PhysOverlapTime;
if (total_time > 0.1f)
total_time = 0.1f;
// split the timestep into fixed size chunks
int num_loops = (int) (total_time / m_PhysTimestep);
Scalar timestep = m_PhysTimestep;
if ( false /*m_allow_smaller_timesteps*/ )
{
if (num_loops == 0)
num_loops = 1;
timestep = total_time / num_loops;
}
m_PhysOverlapTime = total_time - num_loops * timestep;
// TCPreAllocDynamicLinkList<CJL_PhysicsActor>& rActorList = m_pStage->m_pPhysicsManager->GetActorList();
// TCPreAllocDynamicLinkList<CJL_PhysicsActor>::LinkListIterator itrActor;
int i;
for (i=0 ; i<num_loops ; ++i)
{
// m_physics_time += timestep;
// apply gravity
/* for( itrActor = rActorList.Begin();
itrActor != rActorList.End();
itrActor++ )
{
if( !(itrActor->GetActorFlag() & JL_ACTOR_STATIC) )
itrActor->AddWorldForce( itrActor->GetMass() * Vector3(0,-9.8f,0) );
}
*/
ProfileBegin( "Entity Update (Physics)" );
// update physics properties that are specific to each entity
// DO NOT CONFUSE THIS WITH CCopyEntity::UpdatePhysics()
CCopyEntity *pEntity;
for( pEntity = m_pEntityInUse.get();
pEntity != NULL;
pEntity = pEntity->m_pNextRawPtr )
{
if( pEntity->GetEntityFlags() & BETYPE_COPY_PARENT_POSE )
pEntity->CopyParentPose();
// if( pEntity->inuse && pEntity->pPhysicsActor )
if( pEntity->inuse && 0 < pEntity->m_vecpPhysicsActor.size() )
pEntity->pBaseEntity->UpdatePhysics( pEntity, timestep );
UpdateEntityAfterMoving( pEntity );
}
ProfileEnd( "Entity Update (Physics)" );
{
PROFILE_SCOPE( "Physics Simulation" );
// handle the motions and collisions of rigid body entities
// m_pStage->m_pPhysicsManager->Integrate( timestep );
m_pStage->GetPhysicsScene()->Simulate( timestep );
while( !m_pStage->GetPhysicsScene()->FetchResults( physics::SimulationStatus::RigidBodyFinished ) )
{}
}
// clear forces on actors
/* for( itrActor = rActorList.Begin();
itrActor != rActorList.End();
itrActor++ )
{
itrActor->ClearForces();
}
*/
}
}