Kollisionen auf Map
Übersicht

![]() |
ozzi789Betreff: Kollisionen auf Map |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich weiss ... aber könnte jemand mit Geduld mir beibringen wie Man eine Kollision zwichen der Cam und dem "Terrain" erstellt und wie man .3ds schönt einfügt (Kann ich schon aber sie ladnen meist irgendwo)
Thx Hier den Script den ich bis jetz mal gebastelt habe (Heightmap mit wasser in dem man rumfliegen kann) Code: [AUSKLAPPEN] Graphics3D 640,480,16,2 SetBuffer BackBuffer() TFormFilter 20 AppTitle"3D Adventure" Global fpsrate,loops, fpstime Print "Welcome to 3D Adventure" Print "^^^^^^^^^^^^^^^^^^^^^^^" Graphics3D 1024,768,32,1 Print "Choose Map , 1 (Big), 2(Big2) , 3(Small) or 4(Small2) " .start Wahl$ = Input ("") Select Wahl Case "1" terrain=LoadTerrain("c:\Graphics\heightmapbig1.bmp") Case "2" terrain=LoadTerrain("c:\Graphics\heightmapbig2.bmp") Case "3" terrain=LoadTerrain("c:\Graphics\heightmapsmall1.bmp") Case "4" terrain=LoadTerrain("c:\Graphics\heightmapsmall2.bmp") Default Print "Invalid Number" Goto start End Select hud =LoadImage ("c:\Graphics\hud.bmp") MaskImage hud ,255,255,255 text1=LoadTexture ("c:\Graphics\grass1.jpg") text2=LoadTexture ("c:\Graphics\grass2.jpg") cube=CreateSphere () cube_text=LoadTexture ("c:\Graphics\text1.bmp",+16+32) EntityTexture cube,cube_text ScaleMesh cube,5,5,5 EntityTexture terrain,text2,0,1 EntityTexture terrain,text1,0,1 ScaleEntity terrain,50,290,50 ScaleEntity terrain,50,290,50 ScaleTexture text1,10,10 ScaleTexture text2,59,59 water=CreatePlane() watertext=LoadTexture ("c:\Graphics\water.bmp",2) EntityTexture water,watertext ScaleTexture watertext,100,100 MoveEntity water,0,10,0 EntityAlpha water,0.6 cam=CreateCamera() MoveEntity cam,0,500,0 PointEntity cam,cube CameraFogMode cam,1 CameraRange cam,1,30000 CameraFogRange cam,100,4000 CameraFogColor cam,41,140,255 CameraClsColor cam,40,140,255 light=CreateLight() TurnEntity light,45,45,0 While Not KeyHit(1) Locate 420,550 Color 255,255,0 Print "Look around with the mouse , move with arrows " Locate 420,570 Print "Use F1 and F2 to switch to Wireframe" fps Color 255,255,0 Print "Fps : "+fpsrate MoveMouse 512,384 If KeyHit(60) WireFrame 1 If KeyHit(59) WireFrame 0 If KeyDown(200) MoveEntity cam,0,0,10 If KeyDown(208) MoveEntity cam,0,0,-8 RotateEntity cam,EntityPitch(cam)+MouseYSpeed(),EntityYaw(cam)-MouseXSpeed(),0 If KeyHit(88) Then SaveBuffer(BackBuffer(),"c:\ScreenshotLOS"+number+".bmp") filename$="c:\Screenshot3Dadventure.m."+number+".bmp" If FileType(filename$)=1 Then number=number + 1 Collisions 1,2,2,3 Collisions 1,3,2,3 RenderWorld DrawImage hud ,0,0 Flip Wend ClearWorld End Function fps() loops = loops+1 If MilliSecs() - fpstime > 1000 Then fpsrate = loops loops = 0 fpstime = MilliSecs() End If Return fpsrate End Function |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
Matthias_Blitzer |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Kollission Camera, Terrain kannste per Entitradius,EntityBox, oder über ein EntityAlpha 0 Objekt machen, das mit dem Terrain kollidiert.
Oder du ermittelst einfach die Höhe des Terrains per TerrainY und gleichst das mit den Koordinaten der Kamera ab. KameraY darf dann nie kleiner sein als TerrainY+... |
||
Bitte nicht ins Pissoir aschen,
ich pinkle ja auch nicht in ihren Aschenbecher. |
![]() |
ozzi789 |
![]() Antworten mit Zitat ![]() |
---|---|---|
Dankeschöön ![]() |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
![]() |
ozzi789 |
![]() Antworten mit Zitat ![]() |
---|---|---|
öhhmm ![]() so etwas oder : If camY = TerrainY collision ... function collision() camY = camY - 8 |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
![]() |
Tankbuster |
![]() Antworten mit Zitat ![]() |
---|---|---|
ehm... ich würde das ein wenig anders machen.
Code: [AUSKLAPPEN] If camY < TerrainY Then camY = TerrainY
so sollte es schöner sein ![]() |
||
Twitter
Download Jewel Snake! Windows|Android |
![]() |
ozzi789Betreff: ... |
![]() Antworten mit Zitat ![]() |
---|---|---|
Aber camY gibts dat oder muss ich die variable irgendwo "verlinken"
thx |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
![]() |
ozzi789 |
![]() Antworten mit Zitat ![]() |
---|---|---|
funkt ned habs probiert ... habs einfach bei den Ifs reingesetz.
Sollte CamY nicht blau eingefärbt werden |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
Darren |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
camy = terrainy + augenhöhe
positionentity camera,posx,camy,posz posx und posz musst du je nach tasten druck erhöhen, bzw verringern... |
||
MFG Darren |
![]() |
ozzi789Betreff: Jupi |
![]() Antworten mit Zitat ![]() |
---|---|---|
habs mit dem commando reference terrainY geschafft (ein bissle umgebaut)
HURRA danke trotzdem für eure behmüungen ![]() ![]() |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
![]() |
Tankbuster |
![]() Antworten mit Zitat ![]() |
---|---|---|
Zitat: Sollte CamY nicht blau eingefärbt werden
Ehm die Funktion CamY gibts garnicht. Die Y-Position der Camera erhältst du mit EntityY(camera). EntityX() und co dürfte hiermit auch geklärt sein ![]() Dann musst du noch die Höhe des Terrains (an der stelle wo die camera grad ist) haben Code: [AUSKLAPPEN] TerrainY(hightmap,EntityX(camera),0,EntityZ(camera))
Und dann kannst du alles wie ich schon gesagt hab machen: Code: [AUSKLAPPEN] Ter_hoehe=TerrainY(hightmap,EntityX(camera),0,EntityZ(camera))
If EntityY(camera)<Ter_hoehe Then positionentity camera,EntityX(camera),Ter_hoehe,EntityZ(camera) Sieht zwar auf den ersten blick kompliziert aus, ist aber ganz einfach wenn man die Befehle versteht. |
||
Twitter
Download Jewel Snake! Windows|Android |
![]() |
ozzi789 |
![]() Antworten mit Zitat ![]() |
---|---|---|
Thx ![]() funkt ganz doll |
||
0x2B || ! 0x2B
C# | C++13 | Java 7 | PHP 5 |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group