mirror of
https://github.com/overte-org/overte.git
synced 2025-04-18 20:56:41 +02:00
Merge pull request #4719 from ericrius1/avatarRange
Added ability to check if an avatar is within specified range of a posit...
This commit is contained in:
commit
b422ffe528
2 changed files with 13 additions and 0 deletions
|
@ -55,6 +55,17 @@ bool AvatarHashMap::containsAvatarWithDisplayName(const QString& displayName) {
|
|||
return !avatarWithDisplayName(displayName).isNull();
|
||||
}
|
||||
|
||||
bool AvatarHashMap::isAvatarInRange(const glm::vec3& position, const float range) {
|
||||
foreach(const AvatarSharedPointer& sharedAvatar, _avatarHash) {
|
||||
glm::vec3 avatarPosition = sharedAvatar->getPosition();
|
||||
float distance = glm::distance(avatarPosition, position);
|
||||
if (distance < range) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
AvatarWeakPointer AvatarHashMap::avatarWithDisplayName(const QString& displayName) {
|
||||
foreach(const AvatarSharedPointer& sharedAvatar, _avatarHash) {
|
||||
if (sharedAvatar->getDisplayName() == displayName) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <Node.h>
|
||||
|
||||
#include "AvatarData.h"
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
typedef QSharedPointer<AvatarData> AvatarSharedPointer;
|
||||
typedef QWeakPointer<AvatarData> AvatarWeakPointer;
|
||||
|
@ -36,6 +37,7 @@ public:
|
|||
public slots:
|
||||
void processAvatarMixerDatagram(const QByteArray& datagram, const QWeakPointer<Node>& mixerWeakPointer);
|
||||
bool containsAvatarWithDisplayName(const QString& displayName);
|
||||
bool isAvatarInRange(const glm::vec3 & position, const float range);
|
||||
AvatarWeakPointer avatarWithDisplayName(const QString& displayname);
|
||||
|
||||
private slots:
|
||||
|
|
Loading…
Reference in a new issue