Jump to content

Andy90

Members
  • Posts

    189
  • Joined

  • Last visited

Posts posted by Andy90

  1. Hello, the issue occurs when the first player collider becomes stuck while moving over edges of models with a mesh collider. This problem is evident in the video. As depicted, you have to jump or wiggle in order to pass these small edges, which isn't particularly enjoyable for the player.

    https://streamable.com/l89yw5

    How to reproduce:

    To reproduce the error, you can add a mesh collider to the office model I sent you yesterday and then place it in a scene. The best scaling is 0.6, 0.6, 0.6. Afterward, try running it with a first-person controller.

     

  2. For some reasons the terrain elevation returns allways 0. Im not sure if its a bug or if i did something wrong.

     

    void LootSpawner::SpawnLoot(shared_ptr<Terrain> terrain, shared_ptr<Map> scene, std::weak_ptr<Entity> player)
    {
        auto entity = GetEntity();
    
        CreateDebugSpehere(entity->GetWorld(), scene, entity->position, Vec4(1.00, 0.07, 0.07, 1.0));
    
        if (!prefabList.empty()) {
            for (int i = 0; i < this->itemCount; i++) {
                float degress = 360 / this->itemCount * i;
                auto radians = Radians(degress);
                auto distance = Random(diameterMin, diameterMax);
                auto sin = Sin(degress);
                auto cos = Cos(degress);
    
                float x = entity->GetPosition(true).x + distance * cos;
                float z = entity->GetPosition(true).z + distance * sin;
                float y = terrain->GetElevation(x, z);
    
                Print("Terrain height " + String(y));
    
                int prefabIndex = Random(0, prefabList.size());
                auto prefabName = prefabList[prefabIndex];
                auto prefab = LoadPrefab(entity->GetWorld(), prefabName);
                prefab->SetPosition(x, y, z);
    
                auto lootCrate = prefab->GetComponent<LootCrate>();
                lootCrate->SetPlayer(player);
    
                scene->AddEntity(prefab);
                CreateDebugSpehere(entity->GetWorld(), scene, Vec3(x, y, z));
            }
        }
        this->spawned = true;
    }
    
    void LootSpawner::CreateDebugSpehere(shared_ptr<World> world, shared_ptr<Map> scene, Vec3 location, Vec4 color)
    {
        if (debug) {
            auto sourceSphere = CreateSphere(world);
            sourceSphere->SetColor(color);
            sourceSphere->SetPosition(location);
            scene->AddEntity(sourceSphere);
        }
    }
    
    bool LootSpawner::Load(table& properties, shared_ptr<Stream> binstream, shared_ptr<Map> scene, const LoadFlags flags)
    {
        itemCount = properties["itemCount"];
        prefabs = properties["prefabs"];
        diameterMin = properties["diameterMin"];
        diameterMax = properties["diameterMax"];
        auto player = scene->GetEntity(properties["player"]);
        prefabList = prefabs.Split(";");
    
        for (auto entity : scene->entities) {
            if (entity->As<Terrain>()) {
                SpawnLoot(entity->As<Terrain>(), scene, player);
            }
        }
    
        return true;
    }

     

  3. i testet it with the old shaders and it result in the same problem. The flickering is more intensive if the distance from the model to the center position (0,0,0) is higher.

    • Thanks 1
×
×
  • Create New...