const glm::quat& VerletCapsuleShape::getRotation() const { // NOTE: The "rotation" of this shape must be computed on the fly, // which makes this method MUCH more more expensive than you might expect. glm::vec3 axis; computeNormalizedAxis(axis); VerletCapsuleShape* thisCapsule = const_cast<VerletCapsuleShape*>(this); thisCapsule->_rotation = computeNewRotation(axis); return _rotation; }
void CapsuleShape::setEndPoints(const glm::vec3& startPoint, const glm::vec3& endPoint) { glm::vec3 axis = endPoint - startPoint; _translation = 0.5f * (endPoint + startPoint); float height = glm::length(axis); if (height > EPSILON) { _halfHeight = 0.5f * height; axis /= height; _rotation = computeNewRotation(axis); } updateBoundingRadius(); }