Director class makes my second scene act weird(Physics objects moved)

This is my first time dabbling with director, and it took some playing around to get it working for my first level which connects to my second scene. My first scene plays fine, everything appears to clear and Ive been able to remove any runtimes that were causing me problems, but the second scene plays out strange.

Keep in mind everything is landscape so the player moves along the x axis sideways. Regularly I have a static object that sits at x=-245, my character starts at x=-1500 and moves left until he hits x=-245 which would be where I have it trigger my third scene. For some reason, when I have it go from scene 1 to scene 2, my character reaches roughly x=-475 and triggers the print (“hit wall”).

The object that it hits is completely new(didn’t have an object of the same name in scene 1), but it seems completely random that it would place it there. Earlier on before I tweaked some of the settings, it was doing the same thing, except stopping far earlier, most likely around x=-800 which was about half of the map. This is confusing me beyond belief, does anyone know why it would act in such a way? [import]uid: 67886 topic_id: 14564 reply_id: 314564[/import]

I don’t know if you use the physics engine, but switching between levels with Director gave me some problems, until i stopped the physics engine before i loaded the new scene.

[import]uid: 50459 topic_id: 14564 reply_id: 53915[/import]

I use physics engine, and I use director class – and I don’t have issues when I change scenes (whether changing to another lua file or reloading the same lua file).

That said, I use timer.performWithDelay to launch the changeScene function. That was the only way I could make it work. Not sure if it helps with yours, but I thought I’d mention. [import]uid: 67217 topic_id: 14564 reply_id: 53932[/import]

Weird business. I already had a timer which was set to a second after the character passes the sensor, but simply adding a physics.stop() to immediately before director:changeScene in the function solved that problem. Hopefully this will be able to deal with this kind of thing in the rest of the scenes.

It also looks like not using a timer and trying to directly call the function(not just the changeScene) totally breaks everything. So both of your posts combined seem to fix things. Thanks! [import]uid: 67886 topic_id: 14564 reply_id: 53951[/import]