mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
Clear entities and avatars on exit
This commit is contained in:
parent
4bf98a80b9
commit
790e325248
3 changed files with 16 additions and 1 deletions
|
@ -1233,6 +1233,9 @@ void Application::cleanupBeforeQuit() {
|
|||
}
|
||||
|
||||
Application::~Application() {
|
||||
_entityClipboard->eraseAllOctreeElements();
|
||||
_entityClipboard.reset();
|
||||
|
||||
EntityTreePointer tree = getEntities()->getTree();
|
||||
tree->setSimulation(nullptr);
|
||||
|
||||
|
@ -1242,7 +1245,7 @@ Application::~Application() {
|
|||
_physicsEngine->setCharacterController(nullptr);
|
||||
|
||||
// remove avatars from physics engine
|
||||
DependencyManager::get<AvatarManager>()->clearOtherAvatars();
|
||||
DependencyManager::get<AvatarManager>()->clearAllAvatars();
|
||||
VectorOfMotionStates motionStates;
|
||||
DependencyManager::get<AvatarManager>()->getObjectsToRemoveFromPhysics(motionStates);
|
||||
_physicsEngine->removeObjects(motionStates);
|
||||
|
|
|
@ -250,6 +250,17 @@ void AvatarManager::clearOtherAvatars() {
|
|||
_myAvatar->clearLookAtTargetAvatar();
|
||||
}
|
||||
|
||||
void AvatarManager::clearAllAvatars() {
|
||||
clearOtherAvatars();
|
||||
|
||||
QWriteLocker (locker&_hashLock);
|
||||
|
||||
_myAvatar->die();
|
||||
_myAvatar.reset();
|
||||
|
||||
_avatarHash.clear();
|
||||
}
|
||||
|
||||
void AvatarManager::setLocalLights(const QVector<AvatarManager::LocalLight>& localLights) {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "setLocalLights", Q_ARG(const QVector<AvatarManager::LocalLight>&, localLights));
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
void updateOtherAvatars(float deltaTime);
|
||||
|
||||
void clearOtherAvatars();
|
||||
void clearAllAvatar();
|
||||
|
||||
bool shouldShowReceiveStats() const { return _shouldShowReceiveStats; }
|
||||
|
||||
|
|
Loading…
Reference in a new issue