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!
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!
;FIRST EASYTOK PROGRAM ;WASD TO MOVE ;MOUSE TO TURN ;LEFT CLICK TO SHOOT ;RIGHT CLICK TO REBUILD THE WALL ;SPACE TO TURN ON/OFF PHYSICS REFRESH ;ENTER TO TURN ON/OFF SLOW MOTION SeedRnd MilliSecs() Graphics3D 1024, 768, 32, 1 Global slomo = False Global refresh = False Global frametime1, frametime2, FPS TOK_InitWorld( 0, -40, 0, 5000, 1000) TOK_CreateGround( "Floor", 30, 255, 150, 0) Include "Include\Inc_TimeMachine.bb" Include "Include\Inc_EasyTOK.bb" Global camera = CreateCamera() PositionEntity camera, 0, 15, -10 light = CreateLight() PositionEntity light, 0, 10, 0 BuildWall() While Not KeyHit(1) frametime1 = MilliSecs() TOK_RefreshEasyTOK() If refresh = True Then If slomo = False Then If FPS > 0 Then TOK_RefreshPhysic(1.7/FPS,10) Else If FPS > 0 Then TOK_RefreshPhysic(0.1/FPS,10) EndIf EndIf Receive_Input() RenderWorld Text 0, 0, "Refreshing Physics = " + refresh Text 0, 20, "Slow Motion = " + slomo frametime2 = MilliSecs() If (frametime2-frametime1) <> 0 Then FPS = 1000/(frametime2-frametime1) Text 0, 40, FPS + " FPS" Flip() Wend TOK_FreePhysic() End Function BuildWall() TOK_DeleteRBEntity( "Cube" ) For x = -10 To 10 For y = 1.5 To 10 TOK_CreateRBCube( "Cube", False, x * 2, y * 2, 0, 0, 0, 0, 1, 1, 1, 5, "", Rnd(0, 255), Rnd(0, 255), Rnd(0, 255), 1, 0) Next Next End Function Function Receive_Input() TurnEntity camera, MouseYSpeed(), -1*MouseXSpeed(), 0 MoveMouse 840, 525 If KeyDown(17) Then MoveEntity camera, 0, 0, 1 If KeyDown(31) Then MoveEntity camera, 0, 0, -1 If KeyDown(30) Then MoveEntity camera, -1, 0, 0 If KeyDown(32) Then MoveEntity camera, 1, 0, 0 If MouseHit(1) Then Tmp$ = "bullet" + Rnd(0, 1000) TOK_CreateRBSphere( Tmp$, False, EntityX(camera), EntityY(camera), EntityZ(camera), 90, 0, 0, 1, 5, "", 0, 0, 0, 1, 0) TOK_ApplyImpulseWithAngle( Tmp$, EntityPitch(camera), EntityYaw(camera), 2000) EndIf If KeyHit(57) Then If refresh = True Then refresh = False Else refresh = True EndIf EndIf If KeyHit(28) Then If slomo = False Then slomo = True Else slomo = False EndIf EndIf If MouseHit(2) Then buildwall() End Function