00001 #include "PhTrackingCamera.hpp" 00002 #include "sim/area/Area.hpp" 00003 #include "sim/thing/Actor.hpp" 00004 00005 using namespace se_basic; 00006 using namespace se_client; 00007 using namespace se_core; 00008 00009 namespace se_basic { 00010 00011 const PhTrackingCamera physicsTrackingCamera; 00012 00013 00014 void PhTrackingCamera 00015 ::calcNext(const PhysicsComponent& physics 00016 , const Pos& pos 00017 , Pos& nextPos 00018 , const Move& move 00019 , Move& nextMove 00020 ) const { 00021 00022 // Are physics meaningful at all? 00023 if(!pos.isKeyFramePath(nextPos)) { 00024 // If not skip it 00025 return; 00026 } 00027 00028 // Always stay in the same area as the player 00029 PosComponent* a = ClientSchema::player->nextPos().area(); 00030 if(a != 0 && a != nextPos.area()) { 00031 nextPos.setArea(*a); 00032 } 00033 00034 // Stay glued to the players spawn point 0 00035 const ViewPoint* sp = SpawnComponent::get(*ClientSchema::player)->spawnPoint(0); 00036 nextPos.local_.setViewPoint(*sp); 00037 00038 nextPos.updateWorldViewPoint(); 00039 } 00040 00041 00042 void PhTrackingCamera 00043 ::affect(PhysicsComponent& physics) const { 00044 if(!PosComponent::Ptr(physics)->nextPos().hasArea()) { 00045 // Camera has left all areas - which means 00046 // it should be destroyed 00047 physics.owner()->scheduleForDestruction(); 00048 } 00049 } 00050 00051 }
Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:03 2007 by Doxygen version 1.3.9.1.