Hi All
I seem to be getting a function back from fixture:getUserData() in the callbacks of
world:queryBoundingBox and world:rayCast - not the table I expect.
(the only userData set anywhere in my code is a table, no functions)
for the fixtures in beginContact, endContact etc it's working as expected
i.e.
function beginContact(a, b, coll)
a:getUserData(), b:getUserData() -- works fine.
Some code:
function bbCallback(fixt)
local t = fixt:getUserData()
print('userdata was '..type(t)..' huh?') -- getting function should be table
function rayCallback(fixt)
print('type fixt '..type(fixt))
world:queryBoundingBox(mx, my, mx, my, bbCallback)
world:rayCast( mx, my, mx+20, my, rayCallback )
Like I mentioned, the collision fixtures have userdata ok.
Can anybody confirm if this is bug in love (0.8), or see a problem in my code?
Thanks
problem accessing fixture userdata from rayCast & BB
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: problem accessing fixture userdata from rayCast & BB
Don't see it with my test. Can you provide a working example that shows the behaviour?
I hope I didn't break Reference. :/
I hope I didn't break Reference. :/
Shallow indentations.
Re: problem accessing fixture userdata from rayCast & BB
A test example is working. (darn it)
I'll look into it some more. Seems weird, I'm only setting userdata in one place and
the access to it from collision callbacks is working.
Thanks for a quick response. If it really has me stuck perhaps I'll post the project here.
I'll look into it some more. Seems weird, I'm only setting userdata in one place and
the access to it from collision callbacks is working.
Thanks for a quick response. If it really has me stuck perhaps I'll post the project here.
Re: problem accessing fixture userdata from rayCast & BB
Well I may as well post the project. Perhaps it's something another pair of eyes can spot.
unexpected userdata is at line 32 of file controls.lua
userdata accessed ok at line 12 of file physics.lua
only place userdata set:
line 66 & 77 of physics.lua
(where did the function userdata come from?)
In addition any criticism of the code would be appreciated.
(although it's early version..)
Mucho thanks to anybody who takes a look!
unexpected userdata is at line 32 of file controls.lua
userdata accessed ok at line 12 of file physics.lua
only place userdata set:
line 66 & 77 of physics.lua
(where did the function userdata come from?)
In addition any criticism of the code would be appreciated.
(although it's early version..)
Mucho thanks to anybody who takes a look!
- Attachments
-
- love1.zip
- (902.66 KiB) Downloaded 128 times
Re: problem accessing fixture userdata from rayCast & BB
Ah, coroutines. The warning on the wiki applies to Lua threads as well for now.
I'm looking into possible fixes.
I'm looking into possible fixes.
Shallow indentations.
Re: problem accessing fixture userdata from rayCast & BB
That'd be it.
Would be nice if that wasn't a limitation, but now I know what it is - I can work around it.
Thanks a lot.
Would be nice if that wasn't a limitation, but now I know what it is - I can work around it.
Thanks a lot.
Who is online
Users browsing this forum: Bing [Bot] and 5 guests