mirror of
https://github.com/AleziaKurdis/Overte-community-apps.git
synced 2025-04-10 17:02:08 +02:00
Merge pull request #76 from AleziaKurdis/AppDomainMapper-Avatars
domainMapper application: Add display of avatars present in the domain.
This commit is contained in:
commit
ae8b3d6ac4
2 changed files with 86 additions and 9 deletions
|
@ -325,8 +325,16 @@
|
|||
"shape": "Cube",
|
||||
"parentID": domainMapID,
|
||||
"grab": {"grabbable": false },
|
||||
"dimensions": {"x": DOMAIN_MAP_SIZE * (properties.dimensions.x/DOMAIN_SIZE), "y": DOMAIN_MAP_SIZE * (properties.dimensions.y/DOMAIN_SIZE), "z": DOMAIN_MAP_SIZE * (properties.dimensions.z/DOMAIN_SIZE)},
|
||||
"localPosition": {"x": (DOMAIN_MAP_SIZE/2) * (properties.position.x/(DOMAIN_SIZE/2)), "y": (DOMAIN_MAP_SIZE/2) * (properties.position.y/(DOMAIN_SIZE/2)), "z": (DOMAIN_MAP_SIZE/2) * (properties.position.z/(DOMAIN_SIZE/2)) },
|
||||
"dimensions": {
|
||||
"x": DOMAIN_MAP_SIZE * (properties.dimensions.x/DOMAIN_SIZE),
|
||||
"y": DOMAIN_MAP_SIZE * (properties.dimensions.y/DOMAIN_SIZE),
|
||||
"z": DOMAIN_MAP_SIZE * (properties.dimensions.z/DOMAIN_SIZE)
|
||||
},
|
||||
"localPosition": {
|
||||
"x": (DOMAIN_MAP_SIZE/2) * (properties.position.x/(DOMAIN_SIZE/2)),
|
||||
"y": (DOMAIN_MAP_SIZE/2) * (properties.position.y/(DOMAIN_SIZE/2)),
|
||||
"z": (DOMAIN_MAP_SIZE/2) * (properties.position.z/(DOMAIN_SIZE/2))
|
||||
},
|
||||
"localRotation": properties.rotation,
|
||||
"color": color,
|
||||
"alpha": 0.1,
|
||||
|
@ -341,8 +349,16 @@
|
|||
"shape": "Cube",
|
||||
"parentID": domainMapID,
|
||||
"grab": {"grabbable": false },
|
||||
"dimensions": {"x": DOMAIN_MAP_SIZE * (properties.dimensions.x/DOMAIN_SIZE), "y": DOMAIN_MAP_SIZE * (properties.dimensions.y/DOMAIN_SIZE), "z": DOMAIN_MAP_SIZE * (properties.dimensions.z/DOMAIN_SIZE)},
|
||||
"localPosition": {"x": (DOMAIN_MAP_SIZE/2) * (properties.position.x/(DOMAIN_SIZE/2)), "y": (DOMAIN_MAP_SIZE/2) * (properties.position.y/(DOMAIN_SIZE/2)), "z": (DOMAIN_MAP_SIZE/2) * (properties.position.z/(DOMAIN_SIZE/2)) },
|
||||
"dimensions": {
|
||||
"x": DOMAIN_MAP_SIZE * (properties.dimensions.x/DOMAIN_SIZE),
|
||||
"y": DOMAIN_MAP_SIZE * (properties.dimensions.y/DOMAIN_SIZE),
|
||||
"z": DOMAIN_MAP_SIZE * (properties.dimensions.z/DOMAIN_SIZE)
|
||||
},
|
||||
"localPosition": {
|
||||
"x": (DOMAIN_MAP_SIZE/2) * (properties.position.x/(DOMAIN_SIZE/2)),
|
||||
"y": (DOMAIN_MAP_SIZE/2) * (properties.position.y/(DOMAIN_SIZE/2)),
|
||||
"z": (DOMAIN_MAP_SIZE/2) * (properties.position.z/(DOMAIN_SIZE/2))
|
||||
},
|
||||
"localRotation": properties.rotation,
|
||||
"color": color,
|
||||
"alpha": 1,
|
||||
|
@ -368,9 +384,9 @@
|
|||
"grab": {"grabbable": false },
|
||||
"dimensions": {"x": 4, "y": 0.1, "z": 0.01},
|
||||
"localPosition": {
|
||||
"x": (DOMAIN_MAP_SIZE/2) * (properties.position.x/(DOMAIN_SIZE/2)),
|
||||
"y": ((DOMAIN_MAP_SIZE/2) * (properties.position.y/(DOMAIN_SIZE/2))) + ((DOMAIN_MAP_SIZE * (properties.dimensions.y/DOMAIN_SIZE))/2) + lineHight,
|
||||
"z": (DOMAIN_MAP_SIZE/2) * (properties.position.z/(DOMAIN_SIZE/2))
|
||||
"x": (DOMAIN_MAP_SIZE/2) * (properties.position.x/(DOMAIN_SIZE/2)),
|
||||
"y": ((DOMAIN_MAP_SIZE/2) * (properties.position.y/(DOMAIN_SIZE/2))) + ((DOMAIN_MAP_SIZE * (properties.dimensions.y/DOMAIN_SIZE))/2) + lineHight,
|
||||
"z": (DOMAIN_MAP_SIZE/2) * (properties.position.z/(DOMAIN_SIZE/2))
|
||||
},
|
||||
"text": properties.name,
|
||||
"lineHeight": lineHight,
|
||||
|
@ -387,7 +403,68 @@
|
|||
}, "local");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var avatarIDs = AvatarManager.getAvatarsInRange({"x": 0, "y": 0, "z": 0}, FULL_DOMAIN_SCAN_RADIUS);
|
||||
if (avatarIDs.length > 0) {
|
||||
var avatarColor, avatarName;
|
||||
for (i = 0; i < avatarIDs.length; i++) {
|
||||
properties = AvatarManager.getAvatar(avatarIDs[i]);
|
||||
avatarColor = {"red": 0, "green": 128, "blue": 255};
|
||||
avatarName = properties.sessionDisplayName;
|
||||
if (properties.sessionUUID === MyAvatar.sessionUUID) {
|
||||
avatarName = "YOU";
|
||||
avatarColor = {"red": 255, "green": 32, "blue": 0};
|
||||
}
|
||||
|
||||
id = Entities.addEntity({
|
||||
"name": "AVATAR - " + avatarName,
|
||||
"type": "Shape",
|
||||
"parentID": domainMapID,
|
||||
"shape": "Sphere",
|
||||
"grab": {"grabbable": false },
|
||||
"dimensions": {"x": 0.003, "y": 0.003, "z": 0.003},
|
||||
"localPosition": {
|
||||
"x": (DOMAIN_MAP_SIZE/2) * (properties.position.x/(DOMAIN_SIZE/2)),
|
||||
"y": (DOMAIN_MAP_SIZE/2) * (properties.position.y/(DOMAIN_SIZE/2)),
|
||||
"z": (DOMAIN_MAP_SIZE/2) * (properties.position.z/(DOMAIN_SIZE/2))
|
||||
},
|
||||
"color": avatarColor,
|
||||
"alpha": 0.8,
|
||||
"canCastShadow": false,
|
||||
"collisionless": true,
|
||||
"primitiveMode": "solid"
|
||||
}, "local");
|
||||
makeUnlit(id);
|
||||
|
||||
lineHight = 0.006;
|
||||
margins = 0;
|
||||
id = Entities.addEntity({
|
||||
"name": "Avatar Name - " + avatarName,
|
||||
"type": "Text",
|
||||
"parentID": domainMapID,
|
||||
"grab": {"grabbable": false },
|
||||
"dimensions": {"x": 4, "y": 0.01, "z": 0.01},
|
||||
"localPosition": {
|
||||
"x": (DOMAIN_MAP_SIZE/2) * (properties.position.x/(DOMAIN_SIZE/2)),
|
||||
"y": ((DOMAIN_MAP_SIZE/2) * (properties.position.y/(DOMAIN_SIZE/2))) + lineHight,
|
||||
"z": (DOMAIN_MAP_SIZE/2) * (properties.position.z/(DOMAIN_SIZE/2))
|
||||
},
|
||||
"text": avatarName,
|
||||
"lineHeight": lineHight,
|
||||
"textColor": avatarColor,
|
||||
"textAlpha": 0.8,
|
||||
"backgroundAlpha": 0,
|
||||
"topMargin": margins,
|
||||
"bottomMargin": margins,
|
||||
"unlit": true,
|
||||
"alignment": "center",
|
||||
"billboardMode": "full",
|
||||
"canCastShadow": false,
|
||||
"collisionless": true
|
||||
}, "local");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getTheLargestAxisDimension(dimensions) {
|
||||
|
|
|
@ -328,7 +328,7 @@ var metadata = { "applications":
|
|||
"isActive": true,
|
||||
"directory": "domainMapper",
|
||||
"name": "Domain Mapper",
|
||||
"description": "Generate a 3D miniature representation of your domain's zones. Useful if you have many 'Places' in your domain and are trying to visualize where you can add new ones. The domain overview can also be used in parallel with the 'Create' application to help you adjust kilometers wide zones. (It refreshes every 5 seconds.)",
|
||||
"description": "Generate a 3D miniature representation of your domain's zones. Useful if you have many 'Places' in your domain and are trying to visualize where you can add new ones. The domain overview can also be used in parallel with the 'Create' application to help you adjust kilometers wide zones. This tool also displays where are the avatars in the domain. (It refreshes every 5 seconds.)",
|
||||
"jsfile": "domainMapper/app-domainMapper.js",
|
||||
"icon": "domainMapper/icon_inactive_white.png",
|
||||
"caption": "DOMAP"
|
||||
|
|
Loading…
Reference in a new issue