Skip to content

lightworld rotation scaling issues (lights will not rotate) #33

@RichardEllicott

Description

@RichardEllicott

okay, i have confirmed lightworld rotates (sort of), if i put in the love.graphics.rotate into the actual lightworld function bit, in my code, in ee_engine.lua:


lightWorld:draw(function() --this is the lightworld pass

            love.graphics.rotate(camera.rotation)

            for _,entity in pairs(self.entities) do
                entity:lightdraw()
            end
        end)

i found if i omit, the scaling and translation, it is the closest to working correctly.

i found also, the sequence is important, so lightworld has received the scaling and translation, it is important other draws follow the same sequence (rotation MUST be last)

this investigation suggests the code on the main page might be wrong?? you are not supposed to scale and translate in love.draw()

Please, have a look at my code, at least try using the controls to see. It has WSAD directions, QE scale, and RF rotate.

You can switch on (in ee_engine.lua) a non-lightpass, with Engine.draw_non_lightpass = true

I have managed to get both passes to exactly match each other.

Sorry i am so long winded, the fundamental issue is, the lights do not rotate with the scene, if you rotate my (attempted) camera, you will find the lights do not rotate (so lightworld sprites rotate fine, it's lights do not).

EntityEngine.zip

This little framework, i was hoping to integrate all this stuff, light, physics, camera, and eventually UDP, into one thing bases on the usual sort of Unity style component model. The best bit so far is the physics are optional :)

Summary of code:
main.lua
ee_engine.lua --the singleton
ee_entity.lua --the in game objects

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions