Hey guys,
Is there any way to use “event.other” outside of the collision function it has being referenced in?
Thanks
[import]uid: 40538 topic_id: 17328 reply_id: 317328[/import]
Hey guys,
Is there any way to use “event.other” outside of the collision function it has being referenced in?
Thanks
[import]uid: 40538 topic_id: 17328 reply_id: 317328[/import]
maybe set a global variable then set this variable to event.other inside the collision function [import]uid: 7911 topic_id: 17328 reply_id: 65574[/import]
Encapsulate whatever you’re doing outside the collision function in another function then pass event.other as a parameter to that second function when you call it from within the collision function. [import]uid: 40137 topic_id: 17328 reply_id: 65787[/import]
I’ve tried that but it gives me the following error:
attempt to index global 'event' (a nil value)
Don’t know if it helps but my collision function is a within another function.
[import]uid: 40538 topic_id: 17328 reply_id: 65852[/import]
You should cache it as a local var first and pass that [import]uid: 40137 topic_id: 17328 reply_id: 65859[/import]
Caching it as a local variable gives the same error. [import]uid: 40538 topic_id: 17328 reply_id: 65966[/import]
It works for me, but without any code I can’t see what you’re doing. If you post the code it’s probably a simple solution [import]uid: 40137 topic_id: 17328 reply_id: 65970[/import]
Got it working - I didn’t realize I had to pass the parameter in the collision listener and also in the function itself.
Cheers for your help! [import]uid: 40538 topic_id: 17328 reply_id: 65986[/import]