Maus Problem

Übersicht BlitzBasic Blitz3D

Neue Antwort erstellen

 

MrT100

Betreff: Maus Problem

BeitragFr, Jul 16, 2010 13:47
Antworten mit Zitat
Benutzer-Profile anzeigen
Hallo ich habe folgendes problem unzwar bewegt sich die kamera automatisch nach vorne oder hinten wen ich sie hoch oder runter ziehe

Code: [AUSKLAPPEN]
Graphics3D 800,600,32,1
SetBuffer  BackBuffer()

light = CreateLight()
RotateEntity light,255,255,255

.camara
cam=CreateCamera()
EntityType cam,1
PositionEntity cam, 10,8, 10

.Variablen
Leben = 100
.weld
sphere = CreateSphere()
EntityType sphere, 1
PositionEntity sphere, 10,8, 10
ScaleEntity sphere, 0, 0, 0

bild1=LoadImage("Image\Karte.bmp")


cube1=CreateTerrain(32)
EntityType cube1, 2
EntityColor cube1, 0, 255, 255
PositionEntity cube1, -100, 2, -100
ScaleEntity cube1, 1000, 1, 1000

cube2 = CreateCube()
EntityType cube2, 2
EntityColor cube2, 0, 0, 255
PositionEntity cube2, 2, 2, 2
ScaleEntity cube2, 1, 1, 1
cube3 = CreateCube()
EntityType cube3, 2
EntityColor cube3, 0, 0, 255
PositionEntity cube3, 1, 1.5, 2
ScaleEntity cube3, 1, 1, 1
 
cube4 = CreateCube()
EntityType cube4, 2
EntityColor cube4, 0, 0, 255
PositionEntity cube4, 3, 2.5, 2
ScaleEntity cube4, 1, 1, 1

cube5 = CreateCube()
EntityType cube5, 2
EntityColor cube5, 0,0, 255
PositionEntity cube5, 4, 3, 2
ScaleEntity cube5, 1, 1, 1

cube6 = CreateCube()
EntityType cube6, 2
EntityColor cube6, 255, 255, 255
PositionEntity cube6, 2, 3, -1
ScaleEntity cube6, 10, 1, 2

cube7 = CreateCube()
EntityType cube7, 2
EntityColor cube7, 0, 0, 255
PositionEntity cube7, -12, 3, -1
ScaleEntity cube7, 4, 1, 4

cube8 = CreateCube()
EntityType cube8, 2
EntityColor cube8, 0, 0, 255
PositionEntity cube8, -9, 5, -4
ScaleEntity cube8, 1, 1.5, 1

cube9 = CreateCube()
EntityType cube9, 2
EntityColor cube9, 0, 0, 255
PositionEntity cube9, -15, 5, -4
ScaleEntity cube9, 1, 1.5, 1

cube10 = CreateCube()
EntityType cube10, 2
EntityColor cube10, 0, 0, 255
PositionEntity cube10, -15, 5, 2
ScaleEntity cube10, 1, 1.5, 1

cube11 = CreateCube()
EntityType cube11, 2
EntityColor cube11, 0, 0, 255
PositionEntity cube11, -9, 5, 2
ScaleEntity cube11, 1, 1.5, 1

cube12 = CreateCube()
EntityType cube12, 2
EntityColor cube12, 0, 0, 255
PositionEntity cube12, -12, 7.5, -1
ScaleEntity cube12, 4, 1, 4

cube7 = CreateCube()
EntityType cube7, 2
EntityColor cube7, 0, 0, 255
PositionEntity cube7, 16, 3, -1
ScaleEntity cube7, 4, 1, 4

cube8 = CreateCube()
EntityType cube8, 2
EntityColor cube8, 0, 0, 255
PositionEntity cube8, 13, 5, -4
ScaleEntity cube8, 1, 1.5, 1

cube9 = CreateCube()
EntityType cube9, 2
EntityColor cube9, 0, 0, 255
PositionEntity cube9, 19, 5, -4
ScaleEntity cube9, 1, 1.5, 1

cube10 = CreateCube()
EntityType cube10, 2
EntityColor cube10, 0, 0, 255
PositionEntity cube10, 19, 5, 2
ScaleEntity cube10, 1, 1.5, 1

cube11 = CreateCube()
EntityType cube11, 2
EntityColor cube11, 0, 0, 255
PositionEntity cube11, 13, 5, 2
ScaleEntity cube11, 1, 1.5, 1

cube12 = CreateCube()
EntityType cube12, 2
EntityColor cube12, 0, 0, 255
PositionEntity cube12, 16, 7.5, -1
ScaleEntity cube12, 4, 1, 4


.Steuerung
While Not KeyDown(1)
RotateEntity cam,EntityPitch(cam)+MouseYSpeed(),EntityYaw(cam)-MouseXSpeed(),0 ;die maus




   x# = 0
   y# = 0
   z# = 0

   If KeyDown(31)=1 Then MoveEntity cam,0,0,-0.2
   If KeyDown(17)=1 Then MoveEntity cam,0,0,0.2
   If KeyDown(32)=1 Then MoveEntity cam,0.2,0,0
   If KeyDown(30)=1 Then MoveEntity cam,-0.2,0,0

    MoveEntity cam, x#, - y#, z#
   Collisions 1, 2, 2, 2
   UpdateWorld
   
   col1= CountCollisions(cam)
   For i = 1 To col1
     Text 000, i * 20, "Entity=" + CollisionEntity(cam, i)
     Text 150, i * 20, "Surface=" + CollisionSurface(cam, i)
     Text 300, i * 20, "Triangle=" + CollisionTriangle(cam, i)
  Next
       
   x# = 0
   y# = 0
   z# = 0
   If KeyDown(31)=1 Then MoveEntity sphere,0,0,-0.2
   If KeyDown(17)=1 Then MoveEntity sphere,0,0,0.2
   If KeyDown(32)=1 Then MoveEntity sphere,0.2,0,0
   If KeyDown(30)=1 Then MoveEntity sphere,-0.2,0,0

   MoveEntity cam, x#, - 0.1, z#
MoveEntity sphere, x#, - 0.1, z#

   Collisions 1, 2, 2, 2
      UpdateWorld
   
   col = CountCollisions(sphere)
   Text 0, 0, "Kollision(en):"
   For i = 1 To col
      Text 000, i * 20, "Entity=" + CollisionEntity(sphere, i)
     Text 150, i * 20, "Surface=" + CollisionSurface(sphere, i)
     Text 300, i * 20, "Triangle=" + CollisionTriangle(sphere, i)
   Next
RenderWorld

 
   Flip
Wend
End

schon mal danke im vor raus

ZaP

BeitragFr, Jul 16, 2010 13:50
Antworten mit Zitat
Benutzer-Profile anzeigen
TranslateEntity ist möglicherweise das, was Du suchst.
Starfare: Worklog, Website (download)

NightPhoenix

BeitragFr, Jul 16, 2010 15:05
Antworten mit Zitat
Benutzer-Profile anzeigen
Du bewegst die Kamera immer auf ihrer Y-Achse (Höhe) nach unten, wenn du dich umschaust drehst du aber das Koordinatensystem der kamera mit und so bewegst du dich "rückwärts" wenn du nach unten schaust und "vorwärts" wenn du hoch schaust. Benutz einfach TranslateEntity wie schon vorgeschlagfen oder ein zusätzlichen Pivot (übrigens auch recht praktisch für schmale menschliche Figuren auf die EntityRadius nur schwer umsetzbar ist). Bewege nun einfach den Pivot (z.b. "FussPivot") immer nach unten und die kamera steckt als Child oben drauf.
 

MrT100

BeitragFr, Jul 16, 2010 15:12
Antworten mit Zitat
Benutzer-Profile anzeigen
dank

Neue Antwort erstellen


Übersicht BlitzBasic Blitz3D

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group