zak
26-01-2012, 12:04
of course it is not instantaneous but i want to convey something.
while trying a program called modelviewer http://psch.thinbasic.com/forum/index.php?topic=12.0;prev_next=prev
i come across a situation that pressing move key once as fast as we can are not compatible with the x=x+0.001 as an example, and the object will move more than what we intended by x=x+0.001.
after visualizing the issue i think that the loop go across the "If GetAsyncKeyState(%VK_D) Then x = x + 0.001"" tens or even hundreds of times before the old man heavy finger release his (fast!!) press on the key so the x advanced more and more than intended.
so if we insert a SLEEP function to allow the heavy finger to move up from the key then the x will increased approximately more precisely, and this depends on the speed of your cpu.
like this:
If GetAsyncKeyState(%VK_W) Then
Sleep(30)
LightZ -= 0.005
EndIf
i have found that Petr suggested using sleep before in a bug reported by me http://www.thinbasic.com/community/project.php?issueid=21&filter=all#note2163 but i forget it completely.
also i have found recently a very great function TBGL_GetWindowKeyOnce wich are absolutley precise but you can use it only step by step like this:
If TBGL_GetWindowKeyOnce( hWnd, %VK_W ) Then
'TBGL_ResetKeyState()
'Sleep(delay)
LightZ -= 0.005
EndIf
suitable for moving /rotating models and figures precisely.
if you have added :
TBGL_ResetKeyState()
Sleep(delay)
then it will function like the GetAsyncKeyState/TBGL_GetAsyncKeyState with SLEEP.
the attached example are extracted from the modelviewer mentioned above and manipulated to reflect the issue.
use W,S to move the ball more precisely through the triangle.
use A,D to move the ball horizontally (not precisely)
use <,> to rotate the triangle
i placed the figure in this specific orientation to ask Petr an intuitive question :if there is a hope that the ball when penetrate the triangle can leave a hole in the figure in which we can see through it and whats behind.
i have attached with_tiger_skin2 it is originally posted by Petr in the famous waterpatch example to show that the ball almost will go tear the skin and make a hole in it ,but we can't display a hole since the model are already loaded. for more info look "3D curves texturing between mathematica and thinbasic (http://www.thinbasic.com/community/showthread.php?10835-3D-curves-texturing-between-mathematica-and-thinbasic)"
P.S: i have an idea to make a hole at run time,this is to deal with the object as in the physical world, composed from many smaller objects (such as molecules). and collectively it is making the whole bigger object.
now if a ball penetrate this big object it is simply erase some smaller objects in its path. we just distroy those smaller objects.
i will investigate this approach. even it is possibly a cpu heavy task.
while trying a program called modelviewer http://psch.thinbasic.com/forum/index.php?topic=12.0;prev_next=prev
i come across a situation that pressing move key once as fast as we can are not compatible with the x=x+0.001 as an example, and the object will move more than what we intended by x=x+0.001.
after visualizing the issue i think that the loop go across the "If GetAsyncKeyState(%VK_D) Then x = x + 0.001"" tens or even hundreds of times before the old man heavy finger release his (fast!!) press on the key so the x advanced more and more than intended.
so if we insert a SLEEP function to allow the heavy finger to move up from the key then the x will increased approximately more precisely, and this depends on the speed of your cpu.
like this:
If GetAsyncKeyState(%VK_W) Then
Sleep(30)
LightZ -= 0.005
EndIf
i have found that Petr suggested using sleep before in a bug reported by me http://www.thinbasic.com/community/project.php?issueid=21&filter=all#note2163 but i forget it completely.
also i have found recently a very great function TBGL_GetWindowKeyOnce wich are absolutley precise but you can use it only step by step like this:
If TBGL_GetWindowKeyOnce( hWnd, %VK_W ) Then
'TBGL_ResetKeyState()
'Sleep(delay)
LightZ -= 0.005
EndIf
suitable for moving /rotating models and figures precisely.
if you have added :
TBGL_ResetKeyState()
Sleep(delay)
then it will function like the GetAsyncKeyState/TBGL_GetAsyncKeyState with SLEEP.
the attached example are extracted from the modelviewer mentioned above and manipulated to reflect the issue.
use W,S to move the ball more precisely through the triangle.
use A,D to move the ball horizontally (not precisely)
use <,> to rotate the triangle
i placed the figure in this specific orientation to ask Petr an intuitive question :if there is a hope that the ball when penetrate the triangle can leave a hole in the figure in which we can see through it and whats behind.
i have attached with_tiger_skin2 it is originally posted by Petr in the famous waterpatch example to show that the ball almost will go tear the skin and make a hole in it ,but we can't display a hole since the model are already loaded. for more info look "3D curves texturing between mathematica and thinbasic (http://www.thinbasic.com/community/showthread.php?10835-3D-curves-texturing-between-mathematica-and-thinbasic)"
P.S: i have an idea to make a hole at run time,this is to deal with the object as in the physical world, composed from many smaller objects (such as molecules). and collectively it is making the whole bigger object.
now if a ball penetrate this big object it is simply erase some smaller objects in its path. we just distroy those smaller objects.
i will investigate this approach. even it is possibly a cpu heavy task.