Kollisionsabfrageproblem ?
Verfasst: 18.03.2006 21:28
Hallo
Ich poste es einfach mal um
aber irgendwie denke ich hier ist es mal besser aufgehoben wie vorhin...
Weshalb bleibt der Roboter (Original PureBasic Roboter) etwa 70 Punkte über dem Boden stehen und fält dan nicht mehr weiter herunter?
Achja die Map ist eine Delgine Export V1.36 jeweils alles neuste versionen.
Gruss Ground0
Ich poste es einfach mal um
Code: Alles auswählen
Define.f KeyX, KeyY, MouseX, MouseY
#WeltMesh = 0
#Welt = 0
#RobotMesh = 1
#RobotTextur = 1
#RobotMaterial = 1
#Robot = 1
If InitEngine3D() And InitKeyboard() And InitMouse() And InitNetwork() And InitSound() And InitSprite() And InitSprite3D()
Initialisierung=1
MessageRequester("Initialisierung Beendet", "Mysteri-House wird gestartet...", #PB_MessageRequester_Ok )
Else
MessageRequester("Fehler bei der Initialisierung", "Mysteri-House kann nicht gestartet werden", #PB_MessageRequester_Ok )
End
EndIf
If OpenScreen(1280,800,32, "Mysteri-House")
EnableWorldPhysics(1)
EnableWorldCollisions(1)
Add3DArchive("Welten\", #PB_3DArchive_FileSystem )
Parse3DScripts()
LoadMesh(#WeltMesh, "SacredPlace.mesh")
CreateEntity(#Welt, MeshID(#WeltMesh), #PB_Material_None)
Add3DArchive("Figuren\", #PB_3DArchive_FileSystem )
LoadMesh(#RobotMesh, "Robot.mesh")
LoadTexture(#RobotTextur, "r2skin.jpg")
CreateMaterial(#RobotMaterial, TextureID(#RobotTextur))
CreateEntity(#Robot, MeshID(#RobotMesh), MaterialID(#RobotMaterial))
MoveEntity(#Robot,0,200,0)
;Gravitation und Collisionsinitiallisation
WorldGravity(9.806)
EntityPhysicBody(#Welt, #PB_Entity_StaticBody)
EntityPhysicBody(#Robot, #PB_Entity_BoxBody)
;SetEntityMass(#Welt, 0)
SetEntityMass(#Robot, 1000)
SetEntityFriction(#Robot, 0)
CreateCamera(0, 0, 0, 100, 100)
CameraLocate(0,0,0,100)
;AnimateEntity(#Robot, "Walk")
Repeat
ClearScreen(RGB(0, 0, 0))
ExamineWorldCollisions()
If NextWorldCollision()
If CheckEntityCollision(#Robot, #Welt)
;SetEntityMass(#Robot, 0)
MoveEntity(#Robot,0,200,0)
EndIf
EndIf
If ExamineKeyboard()
If KeyboardPushed(#PB_Key_Left)
KeyX = -11
ElseIf KeyboardPushed(#PB_Key_Right)
KeyX = 11
Else
KeyX = 0
EndIf
If KeyboardPushed(#PB_Key_Up)
KeyY = -11
ElseIf KeyboardPushed(#PB_Key_Down)
KeyY = 11
Else
KeyY = 0
EndIf
If KeyboardPushed(#PB_Key_PageUp)
RollZ = 3
Else
RollZ = 0
EndIf
If KeyboardPushed(#PB_Key_Add)
Frame.f+0.005
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()
FlipBuffers()
Until KeyboardPushed(#PB_Key_Escape) Or Quit = 1
EndIf
Achja die Map ist eine Delgine Export V1.36 jeweils alles neuste versionen.
Gruss Ground0