infinite world

Hello
I want create world which is "infinite". Imagine an infinite board on which some object is moving.
Is obvious that is not possible in "classic" approach. So i want create something like conveyer.
On one side will be objects insert and on other side will be release. And after/before each
step i will whole world moving to new position.
..look at figure 🙂

It's possible? I think it will be work for physic simulation when i change all object position and
then/before i will call step?
I don't try this yet. Just i want know if this is not impasse 🙂 Or have sombode another solution?

thanks
hellou again 🙂
I created test and it looks that it works but i had little problems:

1) cycle throught all objects
Code:
for (b2Body* b = myWorld->GetBodyList(); b; b = b->GetNext())


I think it would be nice have something like "body groups" in which each body possition will be relative to parrent and then just move some objects... because sometimes users have composite objects with more body's. And this can save CPU time.

2) ground body
in world constructor is:
Code:
b2World::b2World(const b2AABB& worldAABB, const b2Vec2& gravity, bool doSleep)
{
...
b2BodyDef bd;
m_groundBody = CreateBody(&bd);
}

When i cycle throught all body objects like 1) paragraph i get m_groundBody object.. Detection this object is only if GeShapeList() return NULL.
If i have another body which haven't shape i have problem...second way how recognize groundBody is user data..but what if user data are not set?
[quote="focus"]
I think it would be nice have something like "body groups" in which each body possition will be relative to parrent and then just move some objects... because sometimes users have composite objects with more body's. And this can save CPU time.
[/code]
group of body? why aren't you using many shape in one body?

p.s. i don't understand point 2, sry
Quote:
group of body? why aren't you using many shape in one body?

Because i need colision between shapes and create joins too. e.g. when i want create human body or rope.

and second point.
problem is when you cycle all body from word. You get ground body too...
ok, so for group of body you can simply create your own class BodyGroup containing the pointers to the bodes, and build function that elaborate data using relative position of the contained body (well it's a nice idea to integrate in box2d^^). Just pay attention if you are using multiple thread.

and for the ground and not-shape object... 1. all your object are in BodyGroup, so you don't have to iterate on all the world and you will not elaborate the BodyGroup of the terrain... Or 2. you can use the userData, just remember to set it to NULL or another know value... i don't think box2d will initialize userData(i can be wrong), so initialize it by yourself^^

Original thread: https://box2d.org/forum/viewtopic.php?t=4682