From 88f73581a5467cd00aaf7699cd43cfb6216bd1fc Mon Sep 17 00:00:00 2001 From: Stefan Suhren Date: Mon, 14 Dec 2015 16:50:02 +0100 Subject: Add bottom hit detection --- src/gldisc.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gldisc.cpp b/src/gldisc.cpp index a2c22b5..03a0c6b 100644 --- a/src/gldisc.cpp +++ b/src/gldisc.cpp @@ -82,12 +82,21 @@ void GLDisc::makeSurface(QVector *pointContainer, bool GLDisc::isHit(QVector3D p1, QVector3D p2) { - if(!GLBody::isHit(p1, p2)) + if (!GLBody::isHit(p1, p2)) { return false; } + QVector3D lineVector = p2 - p1; + QVector3D vecBottom = p1 + lineVector * (-p1.z() / lineVector.z()); + + if (vecBottom.length() < m_circleRadius) + { + return true; + } + + return false; } QVector2D GLDisc::calculatePoint(double sideAngle) -- cgit v1.2.3-70-g09d2