0
\$\begingroup\$

Currently I am using scene2d and I want to implement shadows using Box2d light. I want shadows under characters but when I draw something after render() , it draws nothing. For example, in draw() method of an actor,

    public void draw(Batch batch, float delta){
        super.draw(batch,delta);
        ray_handler.render();       
        batch.draw(Something......)
    }

enter image description here

But when draw before render, it shows no problem.

    public void draw(Batch batch, float delta){
        super.draw(batch,delta);
        batch.draw(Something......)     
        ray_handler.render();
    }

Draw

How can I solve this problem?

\$\endgroup\$
0
\$\begingroup\$

The render() methods of ray handler should not in the batch.begin() and batch.end() methods.

public void draw(Batch batch, float delta){
    super.draw(batch,delta);
    batch.end(); 
    ray_handler.render();     
    batch.begin();
    batch.draw(Something......)
}

Above codes are working properly. The Result looks like this

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.