Skip to content
This repository was archived by the owner on Mar 10, 2021. It is now read-only.

Query Circle Area does not work on circle colliders #28

Open
WoolDoughnut310 opened this issue Jun 20, 2020 · 2 comments
Open

Query Circle Area does not work on circle colliders #28

WoolDoughnut310 opened this issue Jun 20, 2020 · 2 comments

Comments

@WoolDoughnut310
Copy link

I tried the README code but changed the colliders from rectangle to circle but then LÖVE shows an error when I press 'p'

image

function love.load()
    world = physics.newWorld(0, 0, true)
    world:setQueryDebugDrawing(true) -- Draws the area of a query for 10 frames

    colliders = {}
    for i = 1, 200 do
        table.insert(colliders, world:newCircleCollider(love.math.random(0, 800), love.math.random(0, 600), 25))
    end
end

function love.update(dt)
    world:update(dt)
end

function love.draw()
    world:draw()
end

function love.keypressed(key)
    if key == 'p' then
        local colliders = world:queryCircleArea(400, 300, 100)
        for _, collider in ipairs(colliders) do
            collider:applyLinearImpulse(1000, 1000)
        end
    end
end
@george-karma
Copy link

The library does not deal with queries of circle colliders, you can patch it yourself like #26 , but ive already done that at this fork https://github.com/DanWaffle/windfield.

@WoolDoughnut310
Copy link
Author

It worked. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants