mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 18:06:57 +02:00
Fix MS16600: Prevent duplicate Spectator Camera models after crash
This commit is contained in:
parent
1d33f51ca4
commit
b573b16df8
1 changed files with 13 additions and 0 deletions
|
@ -74,6 +74,7 @@
|
||||||
"collisionMask": 7,
|
"collisionMask": 7,
|
||||||
"dynamic": false,
|
"dynamic": false,
|
||||||
"modelURL": Script.resolvePath("spectator-camera.fbx"),
|
"modelURL": Script.resolvePath("spectator-camera.fbx"),
|
||||||
|
"name": "Spectator Camera",
|
||||||
"registrationPoint": {
|
"registrationPoint": {
|
||||||
"x": 0.56,
|
"x": 0.56,
|
||||||
"y": 0.545,
|
"y": 0.545,
|
||||||
|
@ -102,6 +103,18 @@
|
||||||
position: cameraPosition,
|
position: cameraPosition,
|
||||||
localOnly: true
|
localOnly: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Remove the existing camera model from the domain if one exists.
|
||||||
|
// It's easy for this to happen if the user crashes while the Spectator Camera is on.
|
||||||
|
// We do this down here (after the new one is rezzed) so that we don't accidentally delete
|
||||||
|
// the newly-rezzed model.
|
||||||
|
var entityIDs = Entities.findEntitiesByName("Spectator Camera", MyAvatar.position, 100, false);
|
||||||
|
entityIDs.forEach(function (currentEntityID) {
|
||||||
|
var currentEntityOwner = Entities.getEntityProperties(currentEntityID, ['owningAvatarID']).owningAvatarID;
|
||||||
|
if (currentEntityOwner === MyAvatar.sessionUUID && currentEntityID !== camera) {
|
||||||
|
Entities.deleteEntity(currentEntityID);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function Name: spectatorCameraOff()
|
// Function Name: spectatorCameraOff()
|
||||||
|
|
Loading…
Reference in a new issue