Kollisionen mit der Kamera

Übersicht BlitzBasic Blitz3D

Neue Antwort erstellen

 

Ekrits

Betreff: Kollisionen mit der Kamera

BeitragSa, Jan 01, 2005 2:15
Antworten mit Zitat
Benutzer-Profile anzeigen
Hiu, ich hab probleme mit der Kollision von Kamera Tarrain/Objekt. Pls Help

Code: [AUSKLAPPEN]

; TERRAIN.BB
groesse = 2048
Graphics3D 640,460
SetBuffer BackBuffer()
cam = CreateCamera()
PositionEntity cam, 20,45,20
font = LoadFont("Aria", 35,1,1,1)
SetFont font
EntityType cam, 1
Text 260,200,"Loading ..."
AmbientLight 45,219,249
CameraClsColor cam,45,219,249
CameraFogColor cam,13,13,13
CameraFogRange cam,1,1

cube=CreateCube ()
cube_text=LoadTexture ("C:\Daten\Diverses\Downloads\text3.bmp")
EntityTexture cube,cube_text
PositionEntity cube, 1000,45,1000
ScaleEntity cube, 200,100,400
EntityType cube,1
EntityRadius cube,1

cube1=CreateCube ()
cube_text=LoadTexture ("C:\Daten\Diverses\Downloads\text3.bmp")
EntityTexture cube1,cube_text
PositionEntity cube1, 200,100,1120
ScaleEntity cube1, 120,100,400
EntityType cube1,1
EntityRadius cube1,1

terrain = CreateTerrain(groesse)
textur = LoadTexture("C:\Daten\bilder\gras.bmp")
EntityTexture terrain, textur

For i=1 To groesse * groesse / 2
 ModifyTerrain terrain, Rand(groesse), Rand(groesse), Rnd(-1,+1)
Next
EntityType terrain, 2
;Const cube = 2
;Const cam = 2
MoveMouse 320,230
Repeat

 If KeyDown(203) Then TurnEntity cam, 0,+1.8,0
 If KeyDown(205) Then TurnEntity cam, 0,-1.8,0
 If KeyDown(200) Then MoveEntity cam, 0,0,+7
 If KeyDown(208) Then MoveEntity cam, 0,0,-7

;#=EntityX(cam)
;#=EntityY(cam)
;#=EntityZ(cam)
;erra_y#=TerrainY(terrain,x#,y#,z#)+4
;ositionEntity cam,x#,terra_y#,z#

;  CameraRange cam,0.001,1000
;  x=MouseXSpeed()
;  If  x>0 TurnEntity cam, 0   ,-x,   0
;  If  x<0 TurnEntity cam, 0    ,-x,   0;

;  y=MouseYSpeed()
;  If  y>0 TurnEntity cam, y   ,0,   0
;  If  y<0 TurnEntity cam, y    ,0,   0

  CameraRange cam,0.001,1000

 Collisions cam,terrain,2,2
 RenderWorld
 UpdateWorld
; col=CountCollisions(cube)
;
 Flip
Until KeyHit(1)[/list]
EKRITSel: Rechtschreibfehler sind gewollt um eure Aufmerksamkeit zutesten!


Magians vs. Nekromats 100% COMPLETE

dimaster

BeitragSa, Jan 01, 2005 13:20
Antworten mit Zitat
Benutzer-Profile anzeigen
Hallo, so sollte es gehen:
Code: [AUSKLAPPEN]

; TERRAIN.BB
groesse = 2048
Graphics3D 640,460
SetBuffer BackBuffer()
cam = CreateCamera()
PositionEntity cam, 20,45,20
font = LoadFont("Aria", 35,1,1,1)
SetFont font
EntityType cam, 1;cam kann nicht 1 sein wenn cube 1 ist
Text 260,200,"Loading ..."
AmbientLight 45,219,249
CameraClsColor cam,45,219,249
CameraFogColor cam,13,13,13
CameraFogRange cam,1,1

cube=CreateCube ()
cube_text=LoadTexture ("C:\Daten\Diverses\Downloads\text3.bmp")
EntityTexture cube,cube_text
PositionEntity cube, 1000,45,1000
ScaleEntity cube, 200,100,400
EntityType cube,2
EntityRadius cube,1

cube1=CreateCube ()
cube_text=LoadTexture ("C:\Daten\Diverses\Downloads\text3.bmp")
EntityTexture cube1,cube_text
PositionEntity cube1, 200,100,1120
ScaleEntity cube1, 120,100,400
EntityType cube1,2
EntityRadius cube1,1

terrain = CreateTerrain(groesse)
textur = LoadTexture("C:\Daten\bilder\gras.bmp")
EntityTexture terrain, textur

For i=1 To groesse * groesse / 2
 ModifyTerrain terrain, Rand(groesse), Rand(groesse), Rnd(-1,+1)
Next
EntityType terrain, 2
MoveMouse 320,230
Repeat

collisions 1,2,2,2

 If KeyDown(203) Then TurnEntity cam, 0,+1.8,0
 If KeyDown(205) Then TurnEntity cam, 0,-1.8,0
 If KeyDown(200) Then MoveEntity cam, 0,0,+7
 If KeyDown(208) Then MoveEntity cam, 0,0,-7

;#=EntityX(cam)
;#=EntityY(cam)
;#=EntityZ(cam)
;erra_y#=TerrainY(terrain,x#,y#,z#)+4
;ositionEntity cam,x#,terra_y#,z#

;  CameraRange cam,0.001,1000
;  x=MouseXSpeed()
;  If  x>0 TurnEntity cam, 0   ,-x,   0
;  If  x<0 TurnEntity cam, 0    ,-x,   0;

;  y=MouseYSpeed()
;  If  y>0 TurnEntity cam, y   ,0,   0
;  If  y<0 TurnEntity cam, y    ,0,   0

  CameraRange cam,0.001,1000

 RenderWorld
 UpdateWorld
; col=CountCollisions(cube)
;
 Flip
Until KeyHit(1)



wenn du entitytype terrain , 2 und entitytype cam,1 musst dus so schreiben: collisions 1,2,2,2
du könntest es so schreiben wenns du übersichtlicher findest:
const camera = 1
const terr = 2
....
....
entitytype cam,camera
entitytype terrain,terr

...
...
collisions camera,terr,2,2
....

ich hoffe das hilft dir

gruss dimaster
 

Ekrits

BeitragSa, Jan 01, 2005 14:57
Antworten mit Zitat
Benutzer-Profile anzeigen
Ja es hilft Thx
EKRITSel: Rechtschreibfehler sind gewollt um eure Aufmerksamkeit zutesten!


Magians vs. Nekromats 100% COMPLETE
 

Ekrits

BeitragSa, Jan 01, 2005 15:05
Antworten mit Zitat
Benutzer-Profile anzeigen
und wie mach ich es mit cam und cube ???

Code: [AUSKLAPPEN]


; TERRAIN.BB
groesse = 2048
Graphics3D 640,460
SetBuffer BackBuffer()
cam = CreateCamera()
PositionEntity cam, 20,60,20
font = LoadFont("Aria", 35,1,1,1)
SetFont font
EntityType cam, 2
Text 260,200,"Loading ..."
AmbientLight 45,219,249
CameraClsColor cam,45,219,249
CameraFogColor cam,13,13,13
CameraFogRange cam,1,1

;;;;;;;;;;;;
;CUBES;;;;;;
;;;;;;;;;;;;



cube=CreateCube ()
cube_text=LoadTexture ("C:\Daten\Bilder\holz.jpg")
EntityTexture cube,cube_text
PositionEntity cube, 1000,45,1000
ScaleEntity cube, 100,100,100
EntityType cube,1
EntityRadius cube,1

textur = LoadTexture("C:\Daten\bilder\gras.bmp")
boden = CreatePlane()
EntityTexture boden, textur

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;BEWEGUNGEN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MoveMouse 320,230
Repeat

 If KeyDown(203) Then TurnEntity cam, 0,+3,0
 If KeyDown(205) Then TurnEntity cam, 0,-3,0
 If KeyDown(200) Then MoveEntity cam, 0,0,+9
 If KeyDown(208) Then MoveEntity cam, 0,0,-9

 If KeyDown(203) Then TurnEntity ak47, 0,+3,0
 If KeyDown(205) Then TurnEntity ak47, 0,-3,0
 If KeyDown(200) Then MoveEntity ak47, 0,0,-9
 If KeyDown(208) Then MoveEntity ak47, 0,0,+9

 If KeyDown(56) Then MoveEntity ak47, +1.8,0,0
 If KeyDown(157) Then MoveEntity ak47, -1.8,0,0

 If KeyDown(157) Then MoveEntity cam, +1.8,0,0
 If KeyDown(56) Then MoveEntity cam, -1.8,0,0

 Collisions cam,cube,2,2
  CameraRange cam,0.001,1000

 RenderWorld
 UpdateWorld

 Flip
Until KeyHit(1)
EKRITSel: Rechtschreibfehler sind gewollt um eure Aufmerksamkeit zutesten!


Magians vs. Nekromats 100% COMPLETE

dimaster

BeitragSa, Jan 01, 2005 15:56
Antworten mit Zitat
Benutzer-Profile anzeigen
Also eigentlich gleich:

Code: [AUSKLAPPEN]

; TERRAIN.BB
groesse = 2048
Graphics3D 640,460
SetBuffer BackBuffer()
cam = CreateCamera()
PositionEntity cam, 20,60,20
font = LoadFont("Aria", 35,1,1,1)
SetFont font
EntityType cam, 1
Text 260,200,"Loading ..."
AmbientLight 45,219,249
CameraClsColor cam,45,219,249
CameraFogColor cam,13,13,13
CameraFogRange cam,1,1

;;;;;;;;;;;;
;CUBES;;;;;;
;;;;;;;;;;;;



cube=CreateCube ()
cube_text=LoadTexture ("C:\Daten\Bilder\holz.jpg")
EntityTexture cube,cube_text
PositionEntity cube, 1000,45,1000
ScaleEntity cube, 100,100,100
EntityType cube,3;3 weil sonst die gleiche kollision ist wie bei terrain kannst natürlich auch 2 nehmen
EntityRadius cube,1

textur = LoadTexture("C:\Daten\bilder\gras.bmp")
boden = CreatePlane()
EntityTexture boden, textur

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;BEWEGUNGEN;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MoveMouse 320,230
Repeat

 If KeyDown(203) Then TurnEntity cam, 0,+3,0
 If KeyDown(205) Then TurnEntity cam, 0,-3,0
 If KeyDown(200) Then MoveEntity cam, 0,0,+9
 If KeyDown(208) Then MoveEntity cam, 0,0,-9

 If KeyDown(203) Then TurnEntity ak47, 0,+3,0
 If KeyDown(205) Then TurnEntity ak47, 0,-3,0
 If KeyDown(200) Then MoveEntity ak47, 0,0,-9
 If KeyDown(208) Then MoveEntity ak47, 0,0,+9

 If KeyDown(56) Then MoveEntity ak47, +1.8,0,0
 If KeyDown(157) Then MoveEntity ak47, -1.8,0,0

 If KeyDown(157) Then MoveEntity cam, +1.8,0,0
 If KeyDown(56) Then MoveEntity cam, -1.8,0,0

 Collisions 1,3,2,2;warum haste hier wieder so geschrieben : collisions cam,cubes,2,2   solltest du net machen dann gehts net!!!
  CameraRange cam,0.001,1000

 RenderWorld
 UpdateWorld

 Flip
Until KeyHit(1)



gruss dimaster
 

Ekrits

BeitragSa, Jan 01, 2005 16:21
Antworten mit Zitat
Benutzer-Profile anzeigen
Vielen vielen Dank entlich funktioniert. Aber wenn ich gegen einen cube laufe dann kann ich hindurchsehen .
EKRITSel: Rechtschreibfehler sind gewollt um eure Aufmerksamkeit zutesten!


Magians vs. Nekromats 100% COMPLETE

dimaster

BeitragSa, Jan 01, 2005 16:26
Antworten mit Zitat
Benutzer-Profile anzeigen
ich weiss nicht warum das so ist aber es ist halt einfach so
 

Ekrits

BeitragSa, Jan 01, 2005 16:28
Antworten mit Zitat
Benutzer-Profile anzeigen
macvht nichts hauptsache ich hab Kollisionen
EKRITSel: Rechtschreibfehler sind gewollt um eure Aufmerksamkeit zutesten!


Magians vs. Nekromats 100% COMPLETE
 

Ekrits

BeitragSa, Jan 01, 2005 16:34
Antworten mit Zitat
Benutzer-Profile anzeigen
Ich habs du man muss noch einen nur etwas kleiner in ihn rein setzten
EKRITSel: Rechtschreibfehler sind gewollt um eure Aufmerksamkeit zutesten!


Magians vs. Nekromats 100% COMPLETE

dimaster

BeitragSa, Jan 01, 2005 16:42
Antworten mit Zitat
Benutzer-Profile anzeigen
naja so gehts natürlich

Neue Antwort erstellen


Übersicht BlitzBasic Blitz3D

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group