void GravityField::ApplyEffect() { std::vector<ActorBase*>::iterator It; Physics::PhysicsManager* Physics = Entresol::GetSingletonPtr()->GetPhysicsManager(); ActorBase* Act = NULL; if ( !AddedActors.empty() ) { for ( It = AddedActors.begin() ; It != AddedActors.end() ; It++ ) { Act = (*It); Physics->SetIndividualGravity(Act, Grav); } } if ( !RemovedActors.empty() ) { for ( It = RemovedActors.begin() ; It != RemovedActors.end() ; It++ ) { Act = (*It); Physics->SetIndividualGravity(Act, Physics->GetGravity()); } } }
void StartArea::ApplyEffect() { Vector3 Grav(0,0,0); ActorBase* Act = NULL; Physics::PhysicsManager* PhysMan = Entresol::GetSingletonPtr()->GetPhysicsManager(); if(!AddedActors.empty()) { for( std::vector<ActorBase*>::iterator it = AddedActors.begin() ; it != AddedActors.end() ; it++ ) { Act = (*it); ((ActorBasePhysicsSettings*)Act->GetPhysicsSettings())->SetCollisionResponse(false); PhysMan->SetIndividualGravity(Act, Grav); } } if(!RemovedActors.empty()) { for( std::vector<ActorBase*>::iterator it = RemovedActors.begin() ; it != RemovedActors.end() ; it++ ) { Act = (*it); ((ActorBasePhysicsSettings*)Act->GetPhysicsSettings())->SetCollisionResponse(true); PhysMan->SetIndividualGravity(Act, PhysMan->GetGravity()); } } }