mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 05:44:44 +02:00
ray pick against avatar meshes rather than capsules
This commit is contained in:
parent
03ed36cf33
commit
c3dbe5d9c4
1 changed files with 12 additions and 5 deletions
|
@ -425,13 +425,20 @@ RayToAvatarIntersectionResult AvatarManager::findRayIntersection(const PickRay&
|
||||||
}
|
}
|
||||||
|
|
||||||
float distance;
|
float distance;
|
||||||
|
BoxFace face;
|
||||||
|
glm::vec3 surfaceNormal;
|
||||||
|
|
||||||
glm::vec3 start;
|
SkeletonModelPointer avatarModel = avatar->getSkeletonModel();
|
||||||
glm::vec3 end;
|
AABox avatarBounds = avatarModel->getRenderableMeshBound();
|
||||||
float radius;
|
if (!avatarBounds.findRayIntersection(ray.origin, normDirection, distance, face, surfaceNormal)) {
|
||||||
avatar->getCapsule(start, end, radius);
|
// ray doesn't intersect avatar's bounding-box
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString extraInfo;
|
||||||
|
bool intersects = avatarModel->findRayIntersectionAgainstSubMeshes(ray.origin, normDirection,
|
||||||
|
distance, face, surfaceNormal, extraInfo, true);
|
||||||
|
|
||||||
bool intersects = findRayCapsuleIntersection(ray.origin, normDirection, start, end, radius, distance);
|
|
||||||
if (intersects && (!result.intersects || distance < result.distance)) {
|
if (intersects && (!result.intersects || distance < result.distance)) {
|
||||||
result.intersects = true;
|
result.intersects = true;
|
||||||
result.avatarID = avatar->getID();
|
result.avatarID = avatar->getID();
|
||||||
|
|
Loading…
Reference in a new issue