Jump to content

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


Dreikblack
 Share

Go to solution Solved by Josh,

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

  • 2 weeks later...

This fixes the problem, but I am still investigating to see why the shadow is not disappearing when the box is parented to the non-shadow-casting pivot.

pivot->SetShadows(true);

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Solution

Fixed this in the source. The correct behavior is the box should stop casting a shadow when it is parented to a non-shadow-casting entity.

My job is to make tools you love, with the features you want, and performance you can't live without.

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...