decentraland / unity-explorer

Apache License 2.0
6 stars 10 forks source link

goerli: Advance Shooting Range decals wont disappear #1080

Closed anicalbano closed 1 week ago

anicalbano commented 2 months ago

Explorer Alpha build version:

0.3.402-g7a23dc7e-main

Issue Description:

When going to the position (83,-3) or (83,-1) we should be able to play on the practice shooting range, and interact with the targets. The normal shooting range is working correctly, but the Advance Shooting Range still has an issue, namely:

Evidence:

https://github.com/decentraland/unity-explorer/assets/56565104/f93cf1e7-217e-48b7-9ad5-85ea8af08839

fcolarich commented 2 months ago

The shooting range is working, the advance shooting range still has issues

fcolarich commented 1 month ago

We fixed the raycast issues, but there is still an issue with the Advance range and the bullet hole decals not disappearing. I updated the ticket with the relevant info.

NickKhalow commented 2 weeks ago

Decal won't disappear because it contains 2 Entities, only parent Entity would be deleted, but child Entity stays in the world by this logic:

` [Query] [All(typeof(SDKTransform), typeof(TransformComponent), typeof(DeleteEntityIntention))] private void OrphanChildrenOfDeletedEntity(ref TransformComponent transformComponentToBeDeleted) { foreach (EntityReference childEntity in transformComponentToBeDeleted.Children) { SetNewChild(ref World.Get(childEntity.Entity), childEntity, 0, sceneRoot, SpecialEntitiesID.SCENE_ROOT_ENTITY); }

transformComponentToBeDeleted.Children.Clear();

} `

NickKhalow commented 2 weeks ago

Previous renderer cleans entities recursively:

    void CleanUpEntityRecursively(IDCLEntity entity, bool removeImmediatelyFromEntitiesList)
    {
        using (var iterator = entity.children.GetEnumerator())
        {
            while (iterator.MoveNext()) { CleanUpEntityRecursively(iterator.Current.Value, removeImmediatelyFromEntitiesList); }
        }

        OnEntityRemoved?.Invoke(entity);

        if (Environment.i.world.sceneBoundsChecker.enabled)
        {
            entity.OnShapeUpdated -= OnEntityShapeUpdated;
            Environment.i.world.sceneBoundsChecker.RemoveEntity(entity, removeIfPersistent: true, resetState: true);
        }

        if (removeImmediatelyFromEntitiesList)
        {
            // Every entity ends up being removed through here
            entity.Cleanup();
            entities.Remove(entity.entityId);
        }
        else { Environment.i.platform.parcelScenesCleaner.MarkForCleanup(entity); }
    }
m3taphysics commented 1 week ago

Pending comments from @nearnshaw