mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
20 lines
478 B
C++
20 lines
478 B
C++
#include "missile.h"
|
|
|
|
namespace battleship{
|
|
using namespace vb01;
|
|
|
|
Missile::Missile(Unit *un, int id, Vector3 tp, Vector3 pos, Quaternion rot) :
|
|
Projectile(un, id, pos, rot),
|
|
targetPos(tp){}
|
|
|
|
void Missile::update(){
|
|
Vector3 targDir = (targetPos - pos).norm();
|
|
float angle = targDir.getAngleBetween(dirVec);
|
|
float ra = (rotAngle < angle ? rotAngle : angle);
|
|
orientAt(Quaternion(ra, dirVec.cross(targDir)) * rot);
|
|
|
|
Projectile::update();
|
|
checkCollision();
|
|
}
|
|
}
|