mirror of
https://github.com/overte-org/overte.git
synced 2025-08-13 04:01:51 +02:00
set position in ctor that takes endpoints
and some cleanup
This commit is contained in:
parent
2c7fcada3b
commit
4e34d0339d
2 changed files with 3 additions and 3 deletions
|
@ -34,6 +34,7 @@ CapsuleShape::CapsuleShape(float radius, float halfHeight, const glm::vec3& posi
|
|||
CapsuleShape::CapsuleShape(float radius, const glm::vec3& startPoint, const glm::vec3& endPoint) :
|
||||
Shape(Shape::CAPSULE_SHAPE), _radius(radius), _halfHeight(0.0f) {
|
||||
glm::vec3 axis = endPoint - startPoint;
|
||||
_position = 0.5f * (endPoint + startPoint);
|
||||
float height = glm::length(axis);
|
||||
if (height > EPSILON) {
|
||||
_halfHeight = 0.5f * height;
|
||||
|
@ -50,12 +51,12 @@ CapsuleShape::CapsuleShape(float radius, const glm::vec3& startPoint, const glm:
|
|||
|
||||
/// \param[out] startPoint is the center of start cap
|
||||
void CapsuleShape::getStartPoint(glm::vec3& startPoint) const {
|
||||
startPoint = getPosition() - _rotation * glm::vec3(0.0f, _halfHeight, 0.0f);
|
||||
startPoint = _position - _rotation * glm::vec3(0.0f, _halfHeight, 0.0f);
|
||||
}
|
||||
|
||||
/// \param[out] endPoint is the center of the end cap
|
||||
void CapsuleShape::getEndPoint(glm::vec3& endPoint) const {
|
||||
endPoint = getPosition() + _rotation * glm::vec3(0.0f, _halfHeight, 0.0f);
|
||||
endPoint = _position + _rotation * glm::vec3(0.0f, _halfHeight, 0.0f);
|
||||
}
|
||||
|
||||
void CapsuleShape::computeNormalizedAxis(glm::vec3& axis) const {
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "Shape.h"
|
||||
|
||||
// adebug bookmark TODO: convert to new world-frame approach
|
||||
// default axis of CapsuleShape is Y-axis
|
||||
|
||||
class CapsuleShape : public Shape {
|
||||
|
|
Loading…
Reference in a new issue