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
Post a Comment