Changeset 10662 in orxonox.OLD for branches/vs-enhencements
- Timestamp:
- May 24, 2007, 3:54:26 PM (17 years ago)
- Location:
- branches/vs-enhencements/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/vs-enhencements/src/util/track/track.h
r10642 r10662 50 50 int nodeCount; //!< The count of points this Track has. 51 51 Curve* curve; //!< The Curve of this Track 52 53 ActionBox* getActionBox(){ return this->actionBox; } 52 54 53 55 private: -
branches/vs-enhencements/src/world_entities/npcs/actionbox_enemy.cc
r10657 r10662 40 40 this->pitch = 0.0f; 41 41 this->dPitch = 0.0; 42 43 this->maxSpeed = 10; 44 this->acceleration = 3; 45 this->speed = 0; 42 46 43 47 if ( root ) … … 96 100 void ActionboxEnemy::moveTowardsBox( ActionBox * box, float dt ) 97 101 { 98 Vector targetPos = State::getPlayer()->getPlayable()->getAbsCoor(); 102 //Vector targetPos = State::getPlayer()->getPlayable()->getAbsCoor(); 103 static float time = 0; 104 time += dt; 105 Vector targetPos = State::getPlayer()->getPlayable()->getAbsCoor() + State::getPlayer()->getPlayable()->getAbsDir().apply(Vector(1, 0, 0))*50*(1.5 + sin(time/5)); 99 106 Vector targetDir = targetPos - myCoor; 100 107 … … 127 134 cur = tmp2; 128 135 129 myDir = cur; 136 myDir = cur; 137 138 Vector fw = cur.apply( Vector(1, 0, 0) ); 139 140 this->speed += this->acceleration*dt; 141 if ( this->speed > this->maxSpeed ) 142 this->speed = this->maxSpeed; 143 this->myCoor += fw*speed*dt; 130 144 } 131 145 -
branches/vs-enhencements/src/world_entities/npcs/actionbox_enemy.h
r10656 r10662 26 26 Quaternion qPitch; 27 27 28 float acceleration; 29 float maxSpeed; 30 float speed; 31 28 32 Quaternion myDir; 29 33 Vector myCoor; -
branches/vs-enhencements/src/world_entities/space_ships/space_ship.cc
r10661 r10662 69 69 70 70 #include "track/track.h" 71 #include "track/action_box.h" 71 72 72 73 … … 345 346 LoadParam(root, "actionWidthPercentage", this, SpaceShip, setActionWidthPercentage); 346 347 347 State::getCamera()->setViewMode(Camera::ViewTop); 348 State::getCamera()->setViewMode(Camera::ViewNormal); 349 State::getCameraTargetNode()->setParent(this); 350 State::getCamera()->setParent(this); 348 351 349 352 LoadParam(root, "reactor", this, SpaceShip, setReactor); … … 828 831 break; 829 832 833 834 case Playable::Vertical: 835 { 836 this->travelNode->setAbsCoor(this->getAbsCoor()); 837 this->travelNode->updateNode(0.01f); 838 839 this->isTravelDistanceInit = false; 840 841 if(this->entityTrack) 842 this->travelNode->setParent(this->entityTrack->getTrackNode()); 843 844 this->setParent(this->travelNode); 845 this->setRelCoor(0,0,0); 846 847 State::getCameraNode()->setParentSoft(this->travelNode); 848 //State::getCameraNode()->setParentSoft(this); 849 //State::getCameraNode()->setRelCoorSoft(-0.01, 40, 0); 850 State::getCameraTargetNode()->setParentSoft(this->travelNode); 851 //State::getCameraTargetNode()->setParentSoft(this); 852 //State::getCameraTargetNode()->setRelCoorSoft(0,0,0); 853 this->setCameraMode(Camera::ViewNormal); 854 State::getCamera()->setEventHandling(false); 855 registerEvent(KeyMapper::PEV_VIEW0); 856 registerEvent(KeyMapper::PEV_VIEW1); 857 registerEvent(KeyMapper::PEV_VIEW2); 858 registerEvent(KeyMapper::PEV_VIEW3); 859 registerEvent(KeyMapper::PEV_VIEW4); 860 registerEvent(KeyMapper::PEV_VIEW5); 861 862 State::getCamera()->setParentMode(PNODE_ALL); 863 864 break; 865 } 866 830 867 default: 831 868 PRINTF(2)("Playmode %s Not Implemented in %s\n", Playable::playmodeToString(this->getPlaymode()).c_str(), this->getClassCName()); … … 990 1027 } 991 1028 case Playable::Vertical: 1029 { 1030 if ( !entityTrack || !entityTrack->getActionBox() ) 1031 { 1032 break; 1033 } 1034 ActionBox * box = entityTrack->getActionBox(); 1035 1036 this->travelVelocity = Vector(0, 0, 0); 1037 float ssss = 50; 1038 if ( this->bForward ) 1039 { 1040 this->travelVelocity += Vector( 0, ssss, 0 ); 1041 } 1042 if ( this->bBackward ) 1043 { 1044 this->travelVelocity += Vector( 0, -ssss, 0 ); 1045 } 1046 if ( this->bLeft ) 1047 { 1048 this->travelVelocity += Vector( 0, 0, -ssss ); 1049 } 1050 if ( this->bRight ) 1051 { 1052 this->travelVelocity += Vector( 0, 0, ssss ); 1053 } 1054 1055 Vector ds = this->travelVelocity*dt; 1056 Vector newPos = this->getRelCoor() + ds; 1057 if ( newPos.y < -(box->getHeight_2()) || newPos.y > box->getHeight_2() ) 1058 { 1059 this->travelVelocity.y = 0; 1060 } 1061 if ( newPos.z > box->getWidth_2() || newPos.z < -(box->getWidth_2()) ) 1062 { 1063 this->travelVelocity.z = 0; 1064 } 1065 } 992 1066 break; 993 1067 default:
Note: See TracChangeset
for help on using the changeset viewer.