Fixed EntityFirstHitByRay not returning outDistance properly
This commit is contained in:
@@ -90,10 +90,10 @@ boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity);
|
|||||||
//Returns the first entity hit by the input ray. entitiesPotentiallyHitSorted needs to be sorted
|
//Returns the first entity hit by the input ray. entitiesPotentiallyHitSorted needs to be sorted
|
||||||
//by their distance to the ray, e.g. result from Octree<EntityAABB>::ObjectsPossiblyHitByRay.
|
//by their distance to the ray, e.g. result from Octree<EntityAABB>::ObjectsPossiblyHitByRay.
|
||||||
//Returns boost::none if none was hit. outDistance will be the distance to the intersection point if the ray intersects.
|
//Returns boost::none if none was hit. outDistance will be the distance to the intersection point if the ray intersects.
|
||||||
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, std::vector<EntityAABB> entitiesPotentiallyHitSorted, float outDistance, glm::vec3& outIntersectPos);
|
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, std::vector<EntityAABB> entitiesPotentiallyHitSorted, float& outDistance, glm::vec3& outIntersectPos);
|
||||||
//Returns the first entity hit by the input ray that exists in the octree.
|
//Returns the first entity hit by the input ray that exists in the octree.
|
||||||
//outDistance will be the distance to the intersection point if the ray intersects.
|
//outDistance will be the distance to the intersection point if the ray intersects.
|
||||||
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, Octree<EntityAABB>* octree, float outDistance, glm::vec3& outIntersectPos);
|
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, Octree<EntityAABB>* octree, float& outDistance, glm::vec3& outIntersectPos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -642,7 +642,7 @@ boost::optional<EntityAABB> AbsoluteAABBExplosionEffect(EntityWrapper& entity)
|
|||||||
return aabb;
|
return aabb;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, std::vector<EntityAABB> entitiesPotentiallyHitSorted, float outDistance, glm::vec3& outIntersectPos)
|
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, std::vector<EntityAABB> entitiesPotentiallyHitSorted, float& outDistance, glm::vec3& outIntersectPos)
|
||||||
{
|
{
|
||||||
for (EntityAABB& entityBox : entitiesPotentiallyHitSorted) {
|
for (EntityAABB& entityBox : entitiesPotentiallyHitSorted) {
|
||||||
if (!entityBox.Entity.HasComponent("Model")) {
|
if (!entityBox.Entity.HasComponent("Model")) {
|
||||||
@@ -667,7 +667,7 @@ boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, std::vector<Enti
|
|||||||
return boost::none;
|
return boost::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, Octree<EntityAABB>* octree, float outDistance, glm::vec3& outIntersectPos)
|
boost::optional<EntityAABB> EntityFirstHitByRay(const Ray& ray, Octree<EntityAABB>* octree, float& outDistance, glm::vec3& outIntersectPos)
|
||||||
{
|
{
|
||||||
std::vector<EntityAABB> outObjects;
|
std::vector<EntityAABB> outObjects;
|
||||||
octree->ObjectsPossiblyHitByRay(ray, outObjects);
|
octree->ObjectsPossiblyHitByRay(ray, outObjects);
|
||||||
|
|||||||
Reference in New Issue
Block a user