Error in the library.
Closed this issue · 3 comments
I decided to try out your library in my project after reading the entire wiki and I came across a rather peculiar error.
I require it like so require "lib.ammo"
where I added your project as a submodule (as per the wiki) but inside my lib directory. I overwrite the love.draw and love.update but call the ammo.update and ammo.draw ... :/
There's no world defined at the moment you call love.mouse.getPosition
, right? getPosition
, by default, calls love.mouse.getWorldX
, and getWorldY
, which requires a world to be in place (as in, ammo.world
needs to be set), or a Camera
to be provided as an argument. For now, either set ammo.world
, use love.mouse.getRawPosition
, or swap out the mouse functions to the raw
ones with love.mouse.switchToRaw
.
There's a number of ways this situation could be improved though. On startup, Ammo could set ammo.world
to a blank world (ammo.world = World:new()
). The mouse functions could be automatically set to the raw
functions when ammo.world == nil
, and the world
functions when ammo.world
is to an instance of World
. I think that solution would be managing things for the user too much.
The main thing was that I wasn't calling any functions except the update/draw functions... anyway I'll do the world check in my events.lua - thanks
You couldn't have only been calling ammo.update
and ammo.draw
judging by the stack trace. (xpcall
-> update
-> getPosition
-> getWorldX
).
Anyway, I'll close this for now.