|
|
@@ -86,16 +86,19 @@ void TerrainPatch::ProcessRayQuery(const RayOctreeQuery& query, PODVector<RayQue
|
|
|
Matrix3x4 inverse(node_->GetWorldTransform().Inverse());
|
|
|
Ray localRay = query.ray_.Transformed(inverse);
|
|
|
float distance = localRay.HitDistance(boundingBox_);
|
|
|
+ Vector3 normal = -query.ray_.direction_;
|
|
|
|
|
|
if (level == RAY_TRIANGLE && distance < query.maxDistance_)
|
|
|
- distance = geometry_->GetHitDistance(localRay);
|
|
|
+ distance = geometry_->GetHitDistance(localRay, &normal);
|
|
|
|
|
|
if (distance < query.maxDistance_)
|
|
|
{
|
|
|
RayQueryResult result;
|
|
|
+ result.position_ = query.ray_.origin_ + distance * query.ray_.direction_;
|
|
|
+ result.normal_ = normal;
|
|
|
+ result.distance_ = distance;
|
|
|
result.drawable_ = this;
|
|
|
result.node_ = node_;
|
|
|
- result.distance_ = distance;
|
|
|
result.subObject_ = M_MAX_UNSIGNED;
|
|
|
results.Push(result);
|
|
|
}
|