Code: Alles auswählen
IncludeFile "Screen3DRequester.pb"
Define.f KeyX, KeyY, MouseX, MouseY
If InitEngine3D()
Add3DArchive("Data\" , #PB_3DArchive_FileSystem)
Add3DArchive("Data\Skybox.zip", #PB_3DArchive_Zip)
InitSprite()
InitKeyboard()
InitMouse()
If Screen3DRequester()
LoadMesh (0, "Robot.mesh")
CreateMaterial(0, LoadTexture(0, "r2skin.jpg"))
CreateEntity(0, MeshID(0), MaterialID(0), -200, 0, 0);Fällt nicht runter, weil ihm kein PhysicBody zugewiesen wurde
CreateEntity(1, MeshID(0), MaterialID(0), -150, 0, 0);Fällt runter wie er sollte
CreateEntity(2, MeshID(0), MaterialID(0), -100, 0, 0);Fällt runter wie er sollte
CreateEntity(3, MeshID(0), MaterialID(0), -50, 0, 0);Sollte runterfallen, tut er aber nicht
CreateEntity(4, MeshID(0), MaterialID(0), 50, 0, 0);Fällt nicht runter, weil ihm kein PhysicBody zugewiesen wurde
CreateEntity(5, MeshID(0), MaterialID(0), 100, 0, 0);Fällt runter wie er sollte
CreateEntity(6, MeshID(0), MaterialID(0), 150, 0, 0);Fällt runter wie er sollte
CreateEntity(7, MeshID(0), MaterialID(0), 200, 0, 0);Sollte runterfallen, tut er aber nicht
AnimateEntity(4, "Walk")
AnimateEntity(5, "Walk")
AnimateEntity(6, "Walk")
AnimateEntity(7, "Walk")
EnableWorldPhysics(1)
;WorldGravity(-9.806)
EntityPhysicBody(0, #PB_Entity_None)
EntityPhysicBody(1, #PB_Entity_BoxBody)
EntityPhysicBody(2, #PB_Entity_SphereBody)
EntityPhysicBody(3, #PB_Entity_StaticBody)
EntityPhysicBody(4, #PB_Entity_None)
EntityPhysicBody(5, #PB_Entity_BoxBody)
EntityPhysicBody(6, #PB_Entity_SphereBody)
EntityPhysicBody(7, #PB_Entity_StaticBody)
SetEntityMass(0,80)
SetEntityMass(1,80)
SetEntityMass(2,80)
SetEntityMass(3,80)
SetEntityMass(4,80)
SetEntityMass(5,80)
SetEntityMass(6,80)
SetEntityMass(7,80)
SetEntityFriction(0,10)
SetEntityFriction(1,10)
SetEntityFriction(2,10)
SetEntityFriction(3,10)
SetEntityFriction(4,10)
SetEntityFriction(5,10)
SetEntityFriction(6,10)
SetEntityFriction(7,10)
EnableWorldCollisions(1)
SkyBox("desert07.jpg")
CreateCamera(0, 0, 0, 100, 100)
CameraLocate(0,0,0,500)
CameraLookAt(0,0,0,0)
Repeat
Screen3DEvents()
ClearScreen(RGB(0, 0, 0))
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -1
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = 1
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -1
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = 1
Else
KeyY = 0
EndIf
EndIf
If ExamineMouse()
MouseX = -MouseDeltaX()/10
MouseY = -MouseDeltaY()/10
EndIf
RotateEntity(1, 1, 0, 0)
RotateEntity(2, 1, 0, 0)
RotateCamera(0, MouseX, MouseY, RollZ)
MoveCamera (0, KeyX, 0, KeyY)
RenderWorld()
Screen3DStats()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Else
MessageRequester("Error", "The 3D Engine can't be initialized",0)
EndIf
End