예제 #1
0
bool CPhysicsManager::AddPhysicActor (CPhysicActor* actor, float mass)
{
	assert(actor != NULL);
	assert( m_pScene != NULL );

	bool isOk = false;
	NxActor* nxActor;
	NxActorDesc* actorDesc = actor->GetActorDesc();

	assert(actorDesc!=NULL);
	nxActor = m_pScene->createActor( *actorDesc );
	if (nxActor!=NULL)
	{
		nxActor->userData = actor->GetUserData();
		if (mass > 0.0f)
			nxActor->setMass(mass);
		actor->CreateActor(nxActor);
		isOk = true;
	}

	return isOk;
}
예제 #2
0
//-----------------------------------------------------------------------------
//  SetDensity
//-----------------------------------------------------------------------------
void    CPhysicObj::SetDensity (int nPartIdx, float fDensity)
{
    assert( nPartIdx < GetNumParts() );
    NxActor*    pActor = GetActor(nPartIdx);
    pActor->setMass( m_InitInfo.pPhysicModel->CalcVolume() * fDensity );
}
예제 #3
0
//-----------------------------------------------------------------------------
//  SetMass
//-----------------------------------------------------------------------------
void    CPhysicObj::SetMass (int nPartIdx, float fMass)
{
    assert( nPartIdx < GetNumParts() );
    NxActor*    pActor = GetActor(nPartIdx);
    pActor->setMass( fMass );
}