Changeset 10188 in orxonox.OLD for branches/playability/src/world_entities/weapons/spike_launcher.cc
- Timestamp:
- Jan 7, 2007, 2:50:47 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/weapons/spike_launcher.cc
r10180 r10188 172 172 } 173 173 174 void SpikeLauncher::updateFireDir(Vector v, float angle){ 175 176 float** m = new float* [3]; 177 for( int i = 0; i < 3 ; i++) 178 m[i] = new float; 179 180 float nx, ny, nz, ca, sa; 181 nx = v.x; 182 ny = v.y; 183 nz = v.z; 184 185 ca = cos (angle); 186 sa = sin (angle); 187 // final version below... easier to to cheat with the one above. 188 /* 189 nx = this->getParent()->getRotationVector().x 190 ny = this->getParent()->getRotationVector().y 191 nz = this->getParent()->getRotationVector().z 192 193 ca = cos (this->getParent()->getAngle()); 194 sa = sin (this->getParent()->getAngle());*/ 195 196 m[0][0] = nx * nx * (1 - ca) + ca; 197 m[0][1] = nx * ny * (1 - ca) + nz * sa; 198 m[0][2] = nx * nz * (1 - ca) - ny * sa; 199 m[1][0] = nx * nz * (1 - ca) - nz * sa; 200 m[1][1] = ny * ny * (1 - ca) + ca; 201 m[1][2] = ny * nz * (1 - ca) + nx * sa; 202 m[2][0] = nx * nz * (1 - ca) + ny * sa; 203 m[2][1] = ny * nz * (1 - ca) - nx * sa; 204 m[2][2] = nz * nz * (1 - ca) + ca; 205 206 float x, y, z; 207 for (int i = 0; i < this->spikes;i++){ 208 x = m[0][0] * this->launcher[i].x + m[0][1] * this->launcher[i].y + m[0][2] * this->launcher[i].z; 209 y = m[1][0] * this->launcher[i].x + m[1][1] * this->launcher[i].y + m[1][2] * this->launcher[i].z; 210 z = m[2][0] * this->launcher[i].x + m[2][1] * this->launcher[i].y + m[2][2] * this->launcher[i].z; 211 212 this->launcher[i] = Vector (x, y, z); 213 } 214 } 215 216 174 217 void SpikeLauncher::fire() 175 218 { 219 // temporary solution to test module 220 updateFireDir(VECTOR_RAND(1), 20); 221 222 176 223 Projectile* pj = NULL; 177 224 // for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)
Note: See TracChangeset
for help on using the changeset viewer.