Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/slot.cc2
-rw-r--r--src/core/slot.h2
-rw-r--r--src/game/base/ship.cc4
3 files changed, 4 insertions, 4 deletions
diff --git a/src/core/slot.cc b/src/core/slot.cc
index 58ab155..58bb51c 100644
--- a/src/core/slot.cc
+++ b/src/core/slot.cc
@@ -47,7 +47,7 @@ void Slot::load(const model::Weapon * weapon_tag)
{
if (weapon_tag) {
set_type(weapon_tag->type());
- set_cone(weapon_tag->cone());
+ set_cone(weapon_tag->cone() * M_PI / 180.0f);
set_location(weapon_tag->location());
set_axis(weapon_tag->axis());
}
diff --git a/src/core/slot.h b/src/core/slot.h
index 596244b..5466de8 100644
--- a/src/core/slot.h
+++ b/src/core/slot.h
@@ -153,7 +153,7 @@ public:
void set_item(Item *item);
/**
- * @brief set slot fire cone, in degrees
+ * @brief set slot fire cone, in radians
* */
inline void set_cone(const float cone)
{
diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc
index e5a5a15..f12700d 100644
--- a/src/game/base/ship.cc
+++ b/src/game/base/ship.cc
@@ -941,13 +941,13 @@ void Ship::frame(const unsigned long elapsed)
// fire a projectile if the angle between the aim direction and the slot's forward direction is small enough
// we only need half the cone angle for the cosine calculation
- float conecos = cosf( slot->cone() / 360.0f * M_PI);
+ float conecos = cosf(slot->cone());
if (cosa >= conecos) {
// aim
math::Vector3f normal(math::crossproduct(projectile_direction, projectile_axis.forward()));
if (normal.length() > MIN_DELTA) {
- float sina = sqrt(1 - cosa * cosa);
+ float sina = sqrt(1.0f - cosa * cosa);
normal.normalize();
projectile_axis.rotate(normal, cosa, sina);