Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/targets.cc49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/client/targets.cc b/src/client/targets.cc
index 08c0e14..8a50510 100644
--- a/src/client/targets.cc
+++ b/src/client/targets.cc
@@ -361,35 +361,36 @@ void frame()
if (entity->id() == current_target_id) {
current_target = entity;
+ }
- // check if the mouse is hovering the entity
- Vector3f v(entity->location() - render::Camera::eye());
- v.normalize();
-
- if (math::dotproduct(render::Camera::axis().forward(), v) > 0.75 ) {
-
- // calculate the distance from entity location to the line [eye - cursor]
- float d = math::Vector3f::length(math::crossproduct( (cursor - render::Camera::eye()) , (render::Camera::eye() - entity->location()))) / math::Vector3f::length(cursor - render::Camera::eye());
-
- float r = entity->radius() * 0.5f;
-
- if (ext_render(entity)->distance() > 512.0f)
- math::clamp(r, 8.0f,r);
- else if (ext_render(entity)->distance() > 256.0f)
- math::clamp(r, 4.0f,r);
- else if (ext_render(entity)->distance() > 128.0f)
- math::clamp(r, 2.0f,r);
+ // check if the mouse is hovering the entity
+ Vector3f v(entity->location() - render::Camera::eye());
+ v.normalize();
+
+ if (math::dotproduct(render::Camera::axis().forward(), v) > 0.75 ) {
+
+ // calculate the distance from entity location to the line [eye - cursor]
+ float d = math::Vector3f::length(math::crossproduct( (cursor - render::Camera::eye()) , (render::Camera::eye() - entity->location()))) / math::Vector3f::length(cursor - render::Camera::eye());
- // if the cursor-beam hits the entity sphere
- if (d < r) {
- float myz = math::distance(cursor, entity->location());
- if (z < 0 || myz < z) {
- current_hover = entity->id();
- z = myz;
- }
+ float r = entity->radius() * 0.5f;
+
+ if (ext_render(entity)->distance() > 512.0f)
+ math::clamp(r, 8.0f,r);
+ else if (ext_render(entity)->distance() > 256.0f)
+ math::clamp(r, 4.0f,r);
+ else if (ext_render(entity)->distance() > 128.0f)
+ math::clamp(r, 2.0f,r);
+
+ // if the cursor-beam hits the entity sphere
+ if (d < r) {
+ float myz = math::distance(cursor, entity->location());
+ if (z < 0 || myz < z) {
+ current_hover = entity->id();
+ z = myz;
}
}
}
+
}
}