Jump to content

No shadows update for an entity when it's a child


Dreikblack
 Share

Recommended Posts

If you do "box->SetParent(pivot);" before loop there will be no shadow at all.

In this example there is a shadow, but with Space box became child of rotating pivot and shadow is stay still static.

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[]) {
    auto displays = GetDisplays();
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);
    auto framebuffer = CreateFramebuffer(window);
    auto world = CreateWorld();

    //Create a camera
    auto camera = CreateCamera(world);
    camera->SetClearColor(0.125);
    camera->SetFov(70);
    camera->Move(-1, 2, -6);

    //Create light
    auto light = CreatePointLight(world);
    light->SetPosition(0, 1, 0);
    light->SetColor(2);

    //Create ground
    auto ground = CreateBox(world, 20, 1, 20);
    ground->SetPosition(0, -0.5, 0);
    ground->SetColor(0, 0.4f, 0);

    auto pivot = CreatePivot(world);
    pivot->SetPosition(0, 0.5, -1);

    auto box = CreateBox(world, 1, 1, 1);
    box->SetPosition(0, 0.5, -1);
   
    while (window->Closed() == false and window->KeyHit(KEY_ESCAPE) == false) {
        if (window->KeyHit(KEY_SPACE)) {
            box->SetParent(pivot);
        }
        pivot->Turn(2);
        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...