java - Lighting in Box2D and Box2DLighting not working when used with a texture -


i'm having problem textures , using lighting in small prototype i'm working on. understand how implement lighting using rayhandlers , whatnot, when place texture on top of body, texture constant visibility (e.g. not effected light). @ moment i've tried using spritebatch render texture object. there different way when using lighting?

thanks, lewis.

if want textures affected lighting, you'll have draw textures first , render lights, this:

public void render(spritebatch batch) {         super.render(batch);          sprite sprite = (sprite) body.getuserdata();         sprite.setposition(body.getposition().x, body.getposition().y);         sprite.setorigin(texture.getwidth()/2, texture.getheight()/2);         sprite.setrotation(body.getangle() * mathutils.radianstodegrees);         sprite.draw(batch);          rayhandler.setcombinedmatrix(getcamera().combined);         rayhandler.updateandrender(); } 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -