How would you go about this problem without inventing your own physics system. I have tried to illustrate the problem in the code below. It's maybe not the best way to show the problem, but i hope you understand.

Is there anything that i have missed or does the code actual work as it should and i just can't do it in this way? or what ?

The problem is not the first time the sphere is goes through the board as the board is nearly vertical, i can live with that, it is the second time where the board is close to a horizontal position.
It does'nt help to increase the radius of the sphere, because if you increase the speed a little you would have the same problem
If anybody have an idea to a solution to this problem


Thanks in advance.
and sorry for my english.
Henrik.
Code: Select all
If InitEngine3D()
InitSprite()
InitKeyboard()
InitMouse()
OpenWindow(0,0,0,1024,768,"Ups",#PB_Window_ScreenCentered|#PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0),0,0,1024,768,0,0,0)
WorldShadows(#PB_Shadow_Additive)
EnableWorldPhysics(1)
CreatePlane(0, 10000, 10000, 100, 100, 150, 150)
CreateEntity(1,MeshID(0),#PB_Material_None, 0, -500, 0)
EntityRenderMode(1, 0)
EntityPhysicBody(1, #PB_Entity_StaticBody)
CreateCube(1, 1.0)
Board=CreateEntity(#PB_Any, MeshID(1), #PB_Material_None)
ScaleEntity(Board, 200, 2, 200)
EntityLocate(Board, 0, 0, 0)
EntityPhysicBody(Board, #PB_Entity_BoxBody ,0,0,0)
;EntityPhysicBody(Board, #PB_Entity_StaticBody ,0,2,1)
;CreateSphere(0, 3, 100, 100)
CreateSphere(0, 2, 100, 100)
Ball= CreateEntity(#PB_Any, MeshID(0), #PB_Material_None)
;EntityLocate(Ball, 0, 150, 0)
EntityLocate(Ball, 0, 100, 0)
EntityPhysicBody(Ball, #PB_Entity_SphereBody, 0.2,1,0)
CreateCamera(0, 0, 0, 100, 100)
CameraLocate(0, 220, 50, 0)
CameraLookAt(0, EntityX(Ball) - 50, EntityY(Ball)-90, EntityZ(Ball))
CreateLight(0, RGB(255, 255, 255), 100, 800, -500)
AmbientColor(RGB(20, 20, 20))
ex.f =0
count = 0.5
Repeat
Delay(1)
While WindowEvent() : Wend
ExamineKeyboard()
;If EntityY(Ball) <120
If EntityY(Ball) < 80
ex = ex + count
EndIf
RotateEntity(Board,ex,0, 0)
RenderWorld()
FlipBuffers()
If EntityY(Ball) < -80
ex=0
RotateEntity(Board,ex,0, 0 )
FreeEntity(Ball)
;CreateSphere(0, 3, 100, 100)
CreateSphere(0, 2, 100, 100)
Ball= CreateEntity(#PB_Any, MeshID(0), #PB_Material_None)
;EntityLocate(Ball, 0, 150, 0)
EntityLocate(Ball, 0, 100, 0)
EntityPhysicBody(Ball, #PB_Entity_SphereBody, 0.5,1,0)
EndIf
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
End