- Timestamp:
- May 16, 2019, 4:57:28 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBloxShip.cc
r12370 r12391 69 69 void OrxoBloxShip::tick(float dt) 70 70 { 71 SUPER(OrxoBloxShip, tick, dt);72 71 Vector3 pos = this->getPosition(); 72 73 //ensure that the ship stays in playing field 74 if(pos.x > width/2) pos.x = -width/2; 75 if(pos.x < -width/2) pos.x = width/2; 76 if(pos.z > height/2) pos.z = -height/2; 77 if(pos.z < -height/2) pos.z = height/2; 78 79 //2D movement, position should always = 0 on y-axis 80 if(pos.y!=0) pos.y = 0; 73 81 this->setPosition(pos); 82 83 84 //if you hit an asteroid, the ship will turn -> you need to reorientate the ship 85 Quaternion ort = this->getOrientation(); 86 ort.x = 0; 87 ort.z = 0; 88 this->setOrientation(ort); 74 89 } 75 90
Note: See TracChangeset
for help on using the changeset viewer.