Probleme mit Kolisionen
Übersicht

![]() |
ewok1Betreff: Probleme mit Kolisionen |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hi
ich will einen Ego shooter programieren doch ich habe ka wie ich machen soll das der spieler nicht durch die wand läuft. Hier der Quelltext: Code: [AUSKLAPPEN] AppTitle "ego shooter" Graphics3D 640, 480, 16,2 SetBuffer BackBuffer() Print "Laden..." If KeyDown(1) Then End Cls Ton = LoadSound ("C:\Users\Patrick\Music\mp5.wav") camera = CreateCamera() PositionEntity camera, 0, 1, 0 ;Kamera CameraZoom camera, 2.5 light = CreateLight() RotateEntity light, 640, 0, 0 ;Licht AmbientLight 255,200,200 terrain = CreateTerrain(64) ;Terrain EntityAlpha terrain, 0.99 cone = CreateCube() ;objekte PositionEntity cone, 45, 3, 20 ScaleEntity cone, 10,3,10 EntityType cone, 2 EntityBox cone, 45, 3, 20, 10, 3, 10 EntityColor cone, 255,255,255 test1 = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\textureConcrete.bmp") EntityTexture cone,test1 cone3 = CreateCube() PositionEntity cone3, 15,5, 20 ScaleEntity cone3, 10,3,10 test2 = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\textureHouse1.bmp") EntityTexture cone3,test2 coneo = CreateCube() PositionEntity coneo, 15,0, 20 ScaleEntity coneo, 10,3,10 testo = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\Plastic.bmp") EntityTexture coneo,testo sphere = CreateSphere(100) PositionEntity sphere, 31,32,32 ScaleEntity sphere, 10,10,10 EntityColor sphere, 0, 0, 255 cylinder = CreateCylinder(100) PositionEntity cylinder, 31,0,32 ScaleEntity cylinder, 1,25,1 EntityColor cylinder, 255, 255, 0 cone4 = CreateCube() PositionEntity cone4, 40,1,40 ScaleEntity cone4, 2,3,2 EntityColor cone4, 0, 255, 255 cone4 = CreateCube() PositionEntity cone4, 13.25,1,48 ScaleEntity cone4, 1,1,1 test = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\texture5.bmp") EntityTexture cone4,test cone5 = CreateCube() PositionEntity cone5, 12,1,48 ScaleEntity cone5, 2,5,2 texture = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\textureConcreted.bmp") EntityTexture cone5,texture M4 = LoadMesh("C:\Users\Patrick\documents\M4 fl red dot.3ds") PositionEntity M4, 0, 0, 0 grass_tex = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\WaterTex.bmp") EntityTexture terrain,grass_tex While Not KeyHit(1) If MouseX() <340 Then TurnEntity camera, 0, 1, 0 If MouseX() >300 Then TurnEntity camera, 0, -1, 0 If MouseX() <440 Then TurnEntity camera, 0, 2, 0 If MouseX() >200 Then TurnEntity camera, 0, -2, 0 If KeyDown(17) = 1 Then MoveEntity camera, 0, 0, 0.1 If KeyDown(31) = 1 Then MoveEntity camera, 0, 0, -0.1 If KeyDown(30) = 1 Then MoveEntity camera, -0.05, 0, 0 If KeyDown(32) = 1 Then MoveEntity camera, 0.05, 0, 0 If MouseX() <340 Then TurnEntity M4, 0, 1, 0 If MouseX() >300 = 1 Then TurnEntity M4, 0, -1, 0 If MouseX() <440 Then TurnEntity M4, 0, 2, 0 If MouseX() >200 = 1 Then TurnEntity M4, 0, -2, 0 If KeyDown(17) = 1 Then MoveEntity M4, 0, 0, 0.1 If KeyDown(31) = 1 Then MoveEntity M4, 0, 0, -0.1 If KeyDown(30) = 1 Then MoveEntity M4, -0.05, 0, 0 If KeyDown(32) = 1 Then MoveEntity M4, 0.05, 0, 0 If KeyDown(25) Then Text 320,240, "Pause" WaitKey If MouseDown(1) = 1 Then PlaySound ton Delay 100 If KeyDown(28) = 1 Then Text 0,20, CameraProject ,camera RenderWorld Bild = LoadImage ("C:\Users\Patrick\Documents\zielvisier.bmp") DrawImage Bild, 0, 0 Flip Cls Wend End Wäre sehr nett wenn mir das jemand erklären könnte |
||
![]() |
blackgecko |
![]() Antworten mit Zitat ![]() |
---|---|---|
Du weist dem Spieler und der "Wand" Kollisionstypen zu. Das sind einfach Zahlenwerte. Siehe EntityType![]() Dann setzt du eventuell Kollisionsradien - mit EntityRadius ![]() ![]() Dann aktivierst du die Kollisionsprüfung zwischen den Objekten - mit Collisions ![]() Alle diese Befehle vor der Hauptschleife verwenden! |
||
So long and thanks for all the fish.
Fedora 17 | Windows 7 || BlitzPlus | BlitzMax Rechtschreibflame GO!!! Deppenapostroph | SeidSeit | Deppenakzent | DassDas | Deppenleerzeichen | TodTot | enzigste.info - Ja, ich sammel die. |
![]() |
ewok1 |
![]() Antworten mit Zitat ![]() |
---|---|---|
Danke ich versuchs mal | ||
![]() |
ewok1 |
![]() Antworten mit Zitat ![]() |
---|---|---|
Hat leider nich funktioniert ![]() |
||
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Wenn du Hilfe willst, solltest du etwas genauer als "funktioniert nicht" werden.
Aktueller Code, Fehlermeldungen + Zeile, usw. |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
![]() |
ewok1 |
![]() Antworten mit Zitat ![]() |
---|---|---|
OK
Die Fehlermeldung lautet Memory access violation und zwar ist diese Zeile das Problem: M4 = LoadMesh("C:\Users\Patrick\documents\M4 fl red dot.3ds") PositionEntity M4, 0, 0, 0 EntityType M4, 2 EntityBox cone, 45, 3, 20, 10,3,10 EntityBox M4, 0, 0, 0, 1,1,1 Collisions M4, cone, 2, 1 grass_tex = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\WaterTex.bmp") EntityTexture terrain,grass_tex |
||
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Wird daran liegen, dass der Mesh nicht geladen wurde, was daran liegen kann, dass der Pfad nicht richtig ist... Teste das einfach:
Code: [AUSKLAPPEN] M4 = LoadMesh [...]
If M4=0 then RuntimeError("M4 nicht geladen!") |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
![]() |
ewok1 |
![]() Antworten mit Zitat ![]() |
---|---|---|
ohne collisions funktioniert es also liegt es nicht am pfad | ||
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Solange du nicht auf das Objekt zugreifst, gibt es auch keinen Fehler ![]() Edit: Lies dir Collisions ![]() |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
![]() |
ewok1 |
![]() Antworten mit Zitat ![]() |
---|---|---|
ich verstehe nicht ganz ![]() Code: [AUSKLAPPEN] Collisions M4, cone,2, 1
Code: [AUSKLAPPEN] Collisions 2, 1,M4, cone
![]() |
||
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Nein.
Nochmal: Lies dir Collisions ![]() |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
![]() |
ewok1 |
![]() Antworten mit Zitat ![]() |
---|---|---|
habs gecheckt das man keine variabelnn setztn muss geht trotzdem nicht -.- zeigt jedoch keine fehlermeldung an | ||
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Und ohne deinen aktuellen Code können wir nicht helfen. | ||
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3 Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64 B3D BMax MaxGUI Stolzer Gewinner des BAC#48, #52 & #92 |
![]() |
ewok1 |
![]() Antworten mit Zitat ![]() |
---|---|---|
ok das ist er:
Code: [AUSKLAPPEN] AppTitle "ego shooter"
Graphics3D 640, 480, 16,2 SetBuffer BackBuffer() Print "Laden..." If KeyDown(1) Then End Cls Ton = LoadSound ("C:\Users\Patrick\Music\mp5.wav") camera = CreateCamera() PositionEntity camera, 0, 1, 0 ;Kamera CameraZoom camera, 2.5 light = CreateLight() RotateEntity light, 640, 0, 0 ;Licht AmbientLight 255,200,200 terrain = CreateTerrain(64) ;Terrain EntityAlpha terrain, 0.99 cone = CreateCube() ;objekte PositionEntity cone, 45, 1, 20 ScaleEntity cone, 10,3,10 EntityType cone, 2 EntityBox cone, 45, 3, 20, 10, 3, 10 EntityColor cone, 255,255,255 test1 = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\textureConcrete.bmp") EntityTexture cone,test1 EntityType cone, 2 cone3 = CreateCube() PositionEntity cone3, 15,5, 20 ScaleEntity cone3, 10,3,10 test2 = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\textureHouse1.bmp") EntityTexture cone3,test2 coneo = CreateCube() PositionEntity coneo, 15,0, 20 ScaleEntity coneo, 10,3,10 testo = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\Plastic.bmp") EntityTexture coneo,testo EntityBox coneo, 0, 0, 0, 1,1,1 sphere = CreateSphere(100) PositionEntity sphere, 31,32,32 ScaleEntity sphere, 10,10,10 EntityColor sphere, 0, 0, 255 cylinder = CreateCylinder(100) PositionEntity cylinder, 31,0,32 ScaleEntity cylinder, 1,25,1 EntityColor cylinder, 255, 255, 0 cone4 = CreateCube() PositionEntity cone4, 40,1,40 ScaleEntity cone4, 2,3,2 EntityColor cone4, 0, 255, 255 cone4 = CreateCube() PositionEntity cone4, 13.25,1,48 ScaleEntity cone4, 1,1,1 test = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\texture5.bmp") EntityTexture cone4,test cone5 = CreateCube() PositionEntity cone5, 12,1,48 ScaleEntity cone5, 2,5,2 texture = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\textureConcreted.bmp") EntityTexture cone5,texture M4 = LoadMesh("C:\Users\Patrick\documents\M4 fl red dot.3ds") PositionEntity M4, 0, 0, 0 EntityType M4, 2 EntityBox cone, 45, 3, 20, 10,3,10 EntityBox M4, 0, 0, 0, 1,1,1 Collisions M4,cone, 2, 2 grass_tex = LoadTexture("C:\Users\Patrick\Documents\BlitzBasic\help\commands\grafik\WaterTex.bmp") EntityTexture terrain,grass_tex While Not KeyHit(1) If MouseX() <340 Then TurnEntity camera, 0, 1, 0 If MouseX() >300 Then TurnEntity camera, 0, -1, 0 If MouseX() <440 Then TurnEntity camera, 0, 2, 0 If MouseX() >200 Then TurnEntity camera, 0, -2, 0 If KeyDown(17) = 1 Then MoveEntity camera, 0, 0, 0.1 If KeyDown(31) = 1 Then MoveEntity camera, 0, 0, -0.1 If KeyDown(30) = 1 Then MoveEntity camera, -0.05, 0, 0 If KeyDown(32) = 1 Then MoveEntity camera, 0.05, 0, 0 If MouseX() <340 Then TurnEntity M4, 0, 1, 0 If MouseX() >300 = 1 Then TurnEntity M4, 0, -1, 0 If MouseX() <440 Then TurnEntity M4, 0, 2, 0 If MouseX() >200 = 1 Then TurnEntity M4, 0, -2, 0 If KeyDown(17) = 1 Then MoveEntity M4, 0, 0, 0.1 If KeyDown(31) = 1 Then MoveEntity M4, 0, 0, -0.1 If KeyDown(30) = 1 Then MoveEntity M4, -0.05, 0, 0 If KeyDown(32) = 1 Then MoveEntity M4, 0.05, 0, 0 If KeyDown(25) Then Text 320,240, "Pause" WaitKey If MouseDown(1) = 1 Then PlaySound ton Delay 100 If KeyDown(28) = 1 Then Text 0,20, CameraProject ,camera RenderWorld Bild = LoadImage ("C:\Users\Patrick\Documents\zielvisier.bmp") DrawImage Bild, 0, 0 Flip Cls Wend End |
||
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
und was genau funktioniert nicht? läuft das Programm? | ||
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3 Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64 B3D BMax MaxGUI Stolzer Gewinner des BAC#48, #52 & #92 |
![]() |
ewok1 |
![]() Antworten mit Zitat ![]() |
---|---|---|
zeigt die fehlermeldung memory access violation und das bei der collisions zeile | ||
![]() |
skey-z |
![]() Antworten mit Zitat ![]() |
---|---|---|
Weil cone und M4 Entities sind und keine Kollissionstypen | ||
Awards:
Coffee's Monatswettbewerb Feb. 08: 1. Platz BAC#57: 2. Platz |
![]() |
ewok1 |
![]() Antworten mit Zitat ![]() |
---|---|---|
wie soll ichs dann lösen ? ohne variabeln? | ||
![]() |
skey-z |
![]() Antworten mit Zitat ![]() |
---|---|---|
Xeres hat Folgendes geschrieben: Nochmal: Lies dir Collisions ![]() |
||
Awards:
Coffee's Monatswettbewerb Feb. 08: 1. Platz BAC#57: 2. Platz |
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
blackgecko hat ganz zu Anfang schon alle wichtigen Befehle aufgezählt - Lesen & Verstehen kann man dir nicht wirklich abnehmen. | ||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group