Physics Body User Data

New to Moai? Get started here with our best tips and tutorials.

Physics Body User Data

Postby plamen » Sun Feb 05, 2012 12:54 am

Hi, I am trying to find implementation of "user data" in MOAIBox2DBody Class. Something that is wrapping the "b2BodyDef bodyDef; bodyDef.userData = &myActor; " - pasted from box2d API.
Is there something similar or i have to find some other way to link application objects to bodies?
plamen
 
Posts: 21
Joined: Sat Jan 28, 2012 1:20 am

Re: Physics Body User Data

Postby ibisum » Mon Feb 06, 2012 5:00 am

Just add a .userdata field to the object you need it associated with! I have '.userdata' on my fixtures, for example .. this is one of those 'duh' things you realize you thought about too much because .. its Lua! Just add fields where you need them. :)
;
--
ibisum@gmail.com
Got a MOAI snippet? Please consider adding it to http://moaisnippets.info
User avatar
ibisum
 
Posts: 1026
Joined: Mon Oct 17, 2011 1:11 am
Location: Vienna, Austria

Re: Physics Body User Data

Postby plamen » Tue Feb 07, 2012 4:49 am

Thanks a lot. I just need to stop .Net thinking, ofc its Lua. Awesome!
plamen
 
Posts: 21
Joined: Sat Jan 28, 2012 1:20 am


Return to New Users

Who is online

Users browsing this forum: No registered users and 0 guests

x