EasyTOK question

Blitz3D Forums/Blitz3D Userlibs/EasyTOK question

chwaga(Posted 2008) [#1]
Hi, I recently purchased easyTOK, and it's working fine, except i have a few questions on some bugs i'm getting, and how to fix them. In the below code, it will boot up fine, and work well, HOWEVER:
1: if you launch the program with refresh = true, the wall will mostly fall over, in contrast to if you launch the program with refresh = false, then press space to make refresh = true, the wall has no problems.

ALSO

2: if you right click (call the function BuildWall, aka, rebuild the wall) while refresh = true, you get some strange anomolies (most of the wall falls right through the floor).

check out this code and please tell me if you find any problems with it!




chwaga(Posted 2008) [#2]
anybody?


Azaratur(Posted 2008) [#3]
I can't answer you but i have a question for you :)
Where can i find easytok demo just to try?
I really don't know what choose for physics!

Aza


chwaga(Posted 2008) [#4]
you can't try it, but you can see the samples at this place


Vorderman(Posted 2008) [#5]
This is a guess but perhaps those few calls that occur to the TOK_RefreshEasyTOK() function when refresh=false would be enough for any interpenetrations to be eliminated, allowing the objects in the wall to settle before the user activates the simulation.

Starting with refresh=true means only 1 call to that function before the physics sim is updated, may be resulting in inter-penetrating bodies moving apart causing the wall to fall over.

Try adding a few calls to that function before the mainloop, or perhaps adjust the spacing on your wall blocks to see if that helps.

This is a complete guess as I don't know what the TOK_RefreshEasyTOK() actually does with regards to the physics.


chwaga(Posted 2008) [#6]
if that was the problem it would have occured earlier, but it didn't start occuring until recently. Your post gave me an idea though, so i'll check it out.


chwaga(Posted 2008) [#7]
i fixed half the problem, the drop in FPS due to the rebuilding the wall caused errors in the speed parameter of TOK_RefreshPhysic, and the developer of easytok said that high speeds can cause errors (if you refresh at a speed of 1.7, it gives similar (but worse) errors, so the line TOK_RefreshPhysic(1.7/FPS,10) caused a high speed when with a low FPS. I found a work around, now i need to FIX it...


chwaga(Posted 2008) [#8]
the same bug was causing the weird thing here:

1: if you launch the program with refresh = true, the wall will mostly fall over, in contrast to if you launch the program with refresh = false, then press space to make refresh = true, the wall has no problems.


as said before, caused by the low FPS at launch


chwaga(Posted 2008) [#9]
i got the solution, just make your accuracy dependent on FPS along with your speed. I used

If FPS > 0 Then TOK_RefreshPhysic(1.7/FPS,0.17*FPS)

so that if the speed goes down, TOK doesn't even refresh. Only time will tell if this solution works.