mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-17 05:01:16 +02:00
Fix contain for collision hulls
This commit is contained in:
parent
3a0b5f9d22
commit
6be0910966
3 changed files with 6 additions and 4 deletions
|
@ -419,8 +419,9 @@ bool RenderableModelEntityItem::contains(const glm::vec3& point) const {
|
|||
if (EntityItem::contains(point) && _model && _model->getCollisionGeometry()) {
|
||||
const QSharedPointer<NetworkGeometry> collisionNetworkGeometry = _model->getCollisionGeometry();
|
||||
const FBXGeometry& collisionGeometry = collisionNetworkGeometry->getFBXGeometry();
|
||||
glm::vec3 transformedPoint = (glm::inverse(getRotation()) * (point - getPosition())) / (getDimensions() / 2.0f);
|
||||
|
||||
return collisionGeometry.convexHullContains(point);
|
||||
return collisionGeometry.convexHullContains(transformedPoint);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -44,10 +44,11 @@ bool RenderableZoneEntityItem::contains(const glm::vec3& point) const {
|
|||
return EntityItem::contains(point);
|
||||
}
|
||||
|
||||
if (EntityItem::contains(point) && _compoundShapeModel) {
|
||||
if (EntityItem::contains(point) && _compoundShapeModel && _compoundShapeModel->isLoaded()) {
|
||||
const FBXGeometry& geometry = _compoundShapeModel->getFBXGeometry();
|
||||
glm::vec3 transformedPoint = (glm::inverse(getRotation()) * (point - getPosition())) / (getDimensions() / 2.0f);
|
||||
|
||||
return geometry.convexHullContains(point);
|
||||
return geometry.convexHullContains(transformedPoint);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -207,7 +207,7 @@ bool isPointBehindTrianglesPlane(glm::vec3 point, glm::vec3 p0, glm::vec3 p1, gl
|
|||
glm::vec3 v1 = p0 - p1, v2 = p2 - p1; // Non-collinear vectors contained in the plane
|
||||
glm::vec3 n = glm::cross(v1, v2); // Plane's normal vector, pointing out of the triangle
|
||||
float d = -glm::dot(n, p0); // Compute plane's equation constant
|
||||
return (glm::dot(n, point) + d) <= 0;
|
||||
return (glm::dot(n, point) + d) >= 0;
|
||||
}
|
||||
|
||||
glm::vec3 extractTranslation(const glm::mat4& matrix) {
|
||||
|
|
Loading…
Reference in a new issue