Codea example "Physics Lab", "Test 9"...

… crashes (literally). :slight_smile:

Hrmm… Same for me. I will dissect the problem later if no one beats me to it.

I’m able to run Physics Lab test 9. It crashes alot, but if you can touch the little cart and start dragging it immediatly, the program doesn’t crash. @Vega, hope that helps if you’re going to debug it.

Dave.

I can run Test9 if I modify the iparameter in Main so that the programme starts with Test9 - otherwise it crashes when I first move the slider from Test8 to Test9.

Okay, the problem appears to be related to a bug in creating a chain type physics body whilst no other physics bodies are present. A quick fix to this problem is to add this line of code:

createCircle(1,1,1)

At the start of the test 9 setup, right below:

function Test9:setup()

Everything should then work fine.

Vega, I just tried that and it still crashed and the new line disappeared. I added it again, closed the project, started the project and again it crashed and the line disappeared. I tried once again this time closing the project, closing Codea, and still the same results.

Are the examples read only? Do I need to make a copy of the project and add the new line there?

Changes you make to it are temporary, but if you make a change and run it, it should stay there for that session. I don’t know, that fix works perfectly for me.

Try long pressing the project and making a copy, put the change there and try to run it.

I tried that fix and it works, but not always. It still crashes some times if I try some of the other examples and then go back to Test 9. Just an FYI, any changes that are made to any of the examples are only temporary. I find that a perfect solution for trying different things with the examples. I can modify them as much as I want to see what happens, and I know that once I’m done and exit the example, the original will still be there. If I want to keep one of my changes for later, I just copy it to a temporary name. A perfect way to learn by trial and error, you always have the same starting point.

OK, I long copied the projected and added the new line, exited the project and Codea for safe measures. The new line stays in place but the project crashes about half of the time when going straight to test 9.

Invoking one of the other tests prior to going to test 9 seems to work every time.

I did notice that selecting restart causes a global nil value error.

I do appreciate your help though.

I got the same as dave1707, with the suggestion of Vega: it crashes going from the preceding tests (1-8) to test 9; running test 9 right from the beginning seems to be ok.

Hi All,

Not the solution but - just remark out line 29 and the lab app runs. Suggest it’s tied up with bad logic on setting up the clear out routine.

Oh, new edit - forgot to mention that the edit is in the main.lua tab!!!

Bri_G

:slight_smile:

Hi @Bri_G, it does not work for me: I get an objects’ chaos :confused:

The easiest fix that seems to work for me is to change line 11 in main. Change Test1() to Test9() and change Test9() to Test1() so that you end up with… tests = {Test9(), Test2(), Test3(), Test4(), Test5(), Test6(), Test7(), Test8(), Test1()}

Hi all,
thanks to all codea-gurus *-:slight_smile: for trying to fix this example, which I consider one of the best examples for iPad/physics/games-lovers and Codea-beginners to wonder/learn about multiple fields especially programming and Newton-physics. By the way, I like a lot this “Physics Lab” because I’d like to use Codea mostly for “non”-game applications :smiley: … but at the end of the day, any physics-simulation can be considered by any “standard” geek as a game :wink:
Greetings,
Victor

I wrestled with this physics crashing bug for quite a while with one of my projects. I eventually just gave up.

The best I could figure out was that it had something to do with creating edges after deleting all or some the bodies in the scene. So, the reason I think Test9 crashes is because of the edges used for the terrain, and the reason dave1707’s fix works is because no bodies are deleted before the edges in that scene are created. But if you slide away from Test9 (now the first test) and back, it will crash. Most of the time.

@invaderJim, thanks.

Hi everyone, I’m looking into the issue with Test9 and edge bodies in general to see if I can fix it. Hopefully it will be cleared up by next release.

@John, many thanks. Oh! I’m sorry, this is not a social network, but I like to say thank you, when I see well done work.