Newbie question: entities tracking
Posted: Sat Jul 16, 2011 1:48 pm
Hello, i've just started to learn the library for my current project, using marmalade sdk (aka airplay sdk) and c++.
I chose chipmunk because i found its entities' (bodies, shapes, etc) structure very simple, intuitive but powerful, but i got stuck, altough i read the entire documentation once, with a banal problem.
Consider the PyramidStack example. Here you have only one global objcet, the space. In the init function you initialize only one object for a body and a shape, but you use them many times to add a lot of entities in the space, in order to build the pyramid. These object are destroyed and the func returns the space full of that stuff.
Now, what if i want to access the structure of one of these blocks (through the space that contains them), for example get the position of a specific body or the friction of a shape? there is some unique ID held by each entity in order to access it? is it the spatial hash? or do i have to keep an object global and never destroy it?
i'm sorry for the stupid question, maybe i didn't get something during my readings
thank you in advance
I chose chipmunk because i found its entities' (bodies, shapes, etc) structure very simple, intuitive but powerful, but i got stuck, altough i read the entire documentation once, with a banal problem.
Consider the PyramidStack example. Here you have only one global objcet, the space. In the init function you initialize only one object for a body and a shape, but you use them many times to add a lot of entities in the space, in order to build the pyramid. These object are destroyed and the func returns the space full of that stuff.
Now, what if i want to access the structure of one of these blocks (through the space that contains them), for example get the position of a specific body or the friction of a shape? there is some unique ID held by each entity in order to access it? is it the spatial hash? or do i have to keep an object global and never destroy it?
i'm sorry for the stupid question, maybe i didn't get something during my readings
thank you in advance