The body/shapes are not in a space because I dont want them effected by gravity.
Also, because they have an infinite moment and if added to the same space as the other objects, the simulation breaks - its as if nothing collides. (this happens when two bodies with infinite mass collide)
Anyhow they do collide just fine, but they dont drag objects along with them.
For example, a plate with a cup on it. If you move the plate, the cup would still be on the plate.
What happens is like the table cloth magic trick
The cloth gets pulled from under the cutlery, and plates etc stay on the table.
Just to clarify, the code in the earlier post was incorrect, its actaully:
Code: Select all
cpBodySlew(body, newPos, TIME_STEP);
cpBodyUpdatePosition(body, TIME_STEP);
body->p = newPos;
I have noticed, that if I remove the last line, the platforms disapear instantly - I guess they have moved offscreen very fast. (*Edit* confirmed this by slowing down the simulation)
Just to be a bit more specific about what I have done:
At the begining of the game loop, I run cpBodyUpdateVelocity for the platforms.
Next I run cpSpaceStep for all the other objects.
Lastly, I run the above code for the platforms.
I believe as you mentioned its because the platforms arent in the cpSpace, but according to the docs things like platforms shouldnt be in the space, but implemented the way I just described.