Kollessions abfrage
Übersicht

haschhaseBetreff: Kollessions abfrage |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
hallo leute
also ich hab ne stadt und eine kamera (camera) jetzt versuch ich, dass ich (camera) nicht immer durch die stadt durchlaufen kann, also sozusagen kollisionsabfrage bei dem terrain ging das wunderbar, nur bei der mesh will das nicht gehen Code: [AUSKLAPPEN] AppTitle "Halo2 Blitz3D (c) by HaschHase"
Graphics3D 1024,768,32,0 SetBuffer BackBuffer() start = MilliSecs() CurFps# = 1000.0 / (MilliSecs() - Start) Print "FPS: "+CurFps# Global camp=CreatePivot() Global camera=CreateCamera(camp) PositionEntity camera,2,2,2 light=CreateLight() RotateEntity light,90,0,0 hud_power = LoadImage("gfx/hud_power.png") MaskImage hud_power,255,255,255 crosshair = LoadImage("gfx/crosshair.png") MaskImage crosshair,255,255,255 terrain=LoadTerrain("gfx/terrain.bmp") TerrainDetail terrain,4000,True ScaleEntity terrain,1,50,1 grass_tex=LoadTexture("gfx/terrain-t.jpg") ScaleTexture grass_tex,50,50 EntityTexture terrain,grass_tex,0,1 Global marine=LoadMesh("models/marine.3DS") ScaleEntity marine,0.2,0.2,0.2 Global stadt=LoadMesh("models/stadt.3DS") ScaleEntity stadt,0.2,0.2,0.2 While Not KeyHit(1) mouse# = MouseYSpeed() If KeyDown(203)=1 Then x#=x#-0.2 If KeyDown(205)=1 Then x#=x#+0.2 If KeyDown(208)=1 Then y#=y#-0.2 If KeyDown(200)=1 Then y#=y#+0.2 If KeyDown(44)=1 Then z#=z#-0.2 If KeyDown(30)=1 Then z#=z#+0.2 If KeyDown(205)=1 Then TurnEntity camera,0,-1,0 If KeyDown(203)=1 Then TurnEntity camera,0,1,0 If KeyDown(208)=1 Then MoveEntity camera,0,0,-0.1 If KeyDown(200)=1 Then MoveEntity camera,0,0,0.1 x#=EntityX(camera) y#=EntityY(camera) z#=EntityZ(camera) terra_y#=TerrainY(terrain,x#,y#,z#)+4 PositionEntity camera,x#,terra_y#,z# If EntityPitch(camera) - mouse > -89 Then RotateEntity camera, EntityPitch(camera) + mouse, EntityYaw(camera), 0 Else RotateEntity camera, -89, EntityYaw(camera), 0 EndIf If EntityPitch(camera) + mouse < 89 Then RotateEntity camera, EntityPitch(camera) + Mouse, EntityYaw(camera), 0 Else RotateEntity camera, 89, EntityYaw(camera), 0 EndIf RotateEntity camera, EntityPitch(camera), EntityYaw(camera) + MouseXSpeed()*-0.3, 0 UpdateWorld() RenderWorld() DrawImage hud_power,20,20,0 DrawImage crosshair,512,383 Text 0,0,EntityPitch(camera) + mouse MoveMouse GraphicsWidth() / 2, GraphicsHeight() / 2 Flip Wend End das ist der ganze code hier die kollisionsabfrage für terrain: Code: [AUSKLAPPEN] If KeyDown(205)=1 Then TurnEntity camera,0,-1,0 If KeyDown(203)=1 Then TurnEntity camera,0,1,0 If KeyDown(208)=1 Then MoveEntity camera,0,0,-0.1 If KeyDown(200)=1 Then MoveEntity camera,0,0,0.1 x#=EntityX(camera) y#=EntityY(camera) z#=EntityZ(camera) terra_y#=TerrainY(terrain,x#,y#,z#)+4 PositionEntity camera,x#,terra_y#,z# thx im vorraus |
||
nei nei so kann das nicht weitergehen... |
Pfaff |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
wenn ich das richtig verstehe schwebt die Kamera über dem Terrain...
Du musste jedem Mesh und der Kamera eine ID geben, wenn jetzt z.B. die Kamera 1 hat und das Terrain 2 dann musst du mit Collisions 1,2,2,3 die kollision abfragen. Den Befehl findest du in der Hilfe besser erklärt. |
||
haschhase |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
ja,aber das müsste auch anders gehen, denn wenn im terrain en hügel geht, geht er , wie als wenn man laufen würde, darüber, also er geht net durch, nur bei der stadt will das net gehen, also müsste das auch ohne ids gehen? | ||
nei nei so kann das nicht weitergehen... |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group