Camera um einen Punkt rotieren lasse. aber wie ??

Übersicht BlitzBasic Blitz3D

Neue Antwort erstellen

Slayer

Betreff: Camera um einen Punkt rotieren lasse. aber wie ??

BeitragMi, Jul 21, 2004 18:53
Antworten mit Zitat
Benutzer-Profile anzeigen
Hi,
stecke mal wieder in einer kleinen 3D krise Wink

Folgendes, ich habe eine Sphere in auf den koordinaten 0,0,0
und eine kammera auf 0,0,-3.5 .
Nun möchte ich das Pitch oder yaw sich auf 0,0,0 festlegen so das ich halt um die Sphere herum Navigieren kann.

Wenn ich in der Kammera das Parent "sphere" setze bin ich mit der kammera in der kugel und komm nicht wieder raus ???

Wie kann ich die Rotationsachse von der Kammera verschieben Question
AMD2500XP, SB5.1, DX9, 512MB DDR333,
XPPro SP1a,ATI 9800SE 256bit 128MB,B3B, B+ immer die neue Version

Henry

BeitragMi, Jul 21, 2004 19:14
Antworten mit Zitat
Benutzer-Profile anzeigen
Öhm, wenn Du die Sphere als Parent der Kamera benutzt, müsstest Du die Kamera eigentlich einzelnd bewegen können (unabhängig von der Kugel) und wenn Du die Sphere bewegst, müsste sich die Kamera mitbewegen.
Ansonsten erstelle doch einfach einen Pivot als Kamera Parent und Look-At Target und platziere den in der Sphere.
Aiya Eärendil Elenion Ancalima!

All you have to decide is what to do with the time that is given to you.

Robsite.de ist eine Anlaufstelle für Tutorials und Tools, die Noobs das Leben leichter machen!
Forensuche ist nicht nur als Lückenfüller in den oberen Links gedacht!

Slayer

BeitragMi, Jul 21, 2004 19:45
Antworten mit Zitat
Benutzer-Profile anzeigen
Jo, Danke.
Das mit dem Pivot ist das was ich gesucht habe.
AMD2500XP, SB5.1, DX9, 512MB DDR333,
XPPro SP1a,ATI 9800SE 256bit 128MB,B3B, B+ immer die neue Version

Slayer

BeitragMi, Jul 21, 2004 20:54
Antworten mit Zitat
Benutzer-Profile anzeigen
Dam Mad
Irgenndwas mach ich falsch.

Hier im ersten Code funktionierts.

Code: [AUSKLAPPEN]
Graphics3D 640,480,0,2
SetBuffer BackBuffer()


Global x#,y#,z#





pivot1=CreatePivot()
PositionEntity pivot1,0,0,0

camera=CreateCamera(Pivot1)
PositionEntity camera,0,0,-10,1


cube=CreateCube()
PositionEntity cube,5,0,0

cube1=CreateCube()
PositionEntity cube1,0,0,0
EntityColor cube1,100,0,0


While Not KeyDown(1)

      If KeyDown (200) Then x = x - 0.5
      If KeyDown (208) Then x = x + 0.5
      If KeyDown (203) Then y = y - 0.5
      If KeyDown (205) Then y = y + 0.5


RotateEntity Pivot1,x,y,z

   RenderWorld
   Flip
Wend
End
 

 


und wenn ich das ganze in meinem Projekt umsetzten will gehts nicht.

Zur Erklärung noch
Mit pfeiltasten wird der würfel gesteuert
Linke Shift Taste und Pfeil oben/Unten, würfel distanz wird geändert
linke Strg und Pfleiltasten, würfel wird gedreht.

Mit Space kann man zwischen Würfel und Camera steuerung wechseln,
wird oben links angezeigt.

Steuerung ist dann gleich wird aber dann auf die Camera angewendet.

Im Camera Modus kann man mit der Taste "b" auf den Pivot modus switchen.

Hier kann/sollte man die Camera mit "WASD" um das Pivot drehen.
Aber genau das funzt nicht.
Irgendwo hab ich was übersehen, finde es aber nicht Smile

So hier mal der code und die Includes

Code:









Code: [AUSKLAPPEN]
;-----------------------------------------------------------------
.s_include_scancodekey.bb
   Include "scancodekey.bb"
   Include "global.bb"
;-----------------------------------------------------------------
.s_graphics
   Graphics3D 800,600,16,2
;-----------------------------------------------------------------
.s_setbuffer_backbuffer
   SetBuffer (BackBuffer ())
;-----------------------------------------------------------------
.s_hintergrund_laden
   ;Global bild1 = LoadImage ("2dback.jpg")
;-----------------------------------------------------------------
;-----------------------------------------------------------------
.s_sphere
;Kugel=CREATESPHERE ([Segmente] [,Parent])
   Global sphere1 = CreateSphere (8)
   PositionEntity sphere1,0.0,0.0,7.0
   
;-----------------------------------------------------------------
.s_pivot1
   Global pivot1=CreatePivot()
      PositionEntity pivot1,Pivot1_x,Pivot1_y,Pivot1_z

   

;-----------------------------------------------------------------
.s_kammera
   Global cam0 = CreateCamera(pivot1)
   PositionEntity cam0,0.0,0.0,-3.5,1
   ;CameraProjMode cam0,1 ;<<<<<<<<<<<<<<<<<<<<<<<<test Neu dazu gekommen
   ;CameraZoom cam0,0.2 ;<<<<<<<<<<<<<<<<<<<<<<<<test Neu dazu gekommen
;----------------------------------------------------------------
.s_licht
   Global licht = CreateLight (1)
;-----------------------------------------------------------------
.s_cube
   Global cube1 = CreateCube ()
   PositionEntity cube1,0.0,0.0,7.0
   RotateEntity cube1,45,45,0
   EntityColor cube1,200,0,100


;Bild=CreateImage (Breite, Höhe [,Frames] [,Modus])
;Global my_buffer = CreateImage (800,600,1)
;      MaskImage my_buffer,0,0,0


.s_while
   While Not KeyHit (k_esc)
;......................................
.s_timer
      timer = MilliSecs()
.s_fps
      fps_count = fps_count + 1
      If (timer - timer_temp)>1000
         timer_temp = Timer
         fps = fps_count
         fps_count = 0
      Endif
;......................................
.s_w_timer
      If (timer-w_timer)> w_run
         w_go = 1
         w_timer = Timer
            Else
               w_go = 0
      Endif
;........................................

.s_f_steuerung
   f_steuerung()
   




;........................................
.s_cube1_position
   PositionEntity cube1,cube1_x,cube1_y,cube1_z
.s_cube1_rotate

   RotateEntity  cube1,cube1_pitch,cube1_yaw,cube1_roll



.s_cam0_position
PositionEntity cam0,cam0_x,cam0_y,cam0_z
.s_cam0_rotate
   RotateEntity  cam0,cam0_pitch,cam0_yaw,cam0_roll

.s_pivot1_rotate
   RotateEntity Pivot1,Pivot1_pitch,Pivot1_yaw,Pivot1_roll
;......................................




   UpdateWorld ()
   RenderWorld ()

;.......................................................
;CopyRect X1, Y1, Breite, Höhe, X2, Y2 [,Quelle] [,Ziel]
;CopyRect 0,0,800,600,0,0,BackBuffer(),ImageBuffer(my_buffer)
;.s_2d_draw
;;DrawBlock bild1,0,0
;DrawImage my_buffer,0,0

;.......................
.s_Text_ausgabe
      Text 10,10,"Das Spiel läuft mit "+fps+" Frames in der Sekunde"
      If dib_steuerung = 0
         Text 10,20,"Würfelsteuerung"
         
            Else
               Text 10,20,"Kammerasteuerung"
                  If dib_pivot1 = 1
                  Text 10,30,"Pivotachse aktive"
                     Else
                        Text 10,30,"Pivotachse nicht aktive"
                  Endif
      Endif

Text 10,50,Pivot1_pitch
.s_flip
   Flip 1
;...................
.s_cls
   Cls


;...................   
.s_wend
   Wend
   End


;=================================================================================

Function f_steuerung()
.s_Steuerungsschalter
   If KeyHit (k_space) Then dib_steuerung = Not dib_steuerung
   If KeyHit(k_b) Then dib_pivot1 = Not dib_pivot1
   ;Hier wird einfach zwischen 0 und 1 geswitcht


.s_wuerfel_Steuerung

If dib_steuerung = 0
   If w_go
   ;Links oben unten rechts
      If KeyDown (k_links) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg))Then  cube1_x = cube1_x - cube1_move_x
      If KeyDown (k_rechts) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg)) Then  cube1_x = cube1_x + cube1_move_x
      If KeyDown (k_unten) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg)) Then  cube1_y = cube1_y - cube1_move_y
      If KeyDown (k_oben)  And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg)) Then  cube1_y = cube1_y + cube1_move_y
   ;Vorwärts rückwärts
      If KeyDown (k_lshift) And KeyDown(k_oben)  Then cube1_z = cube1_z + cube1_move_z
      If KeyDown (k_lshift) And KeyDown (k_unten)  Then cube1_z = cube1_z - cube1_move_z
   ;Drehen
      If KeyDown (k_lstrg) And KeyDown (k_unten)  Then cube1_pitch = cube1_pitch - pitch
      If KeyDown (k_lstrg) And KeyDown (k_oben) Then cube1_pitch = cube1_pitch + pitch
      If KeyDown (k_lstrg) And KeyDown (k_links)  Then cube1_yaw = cube1_yaw - yaw
      If KeyDown (k_lstrg) And KeyDown (k_rechts)  Then cube1_yaw = cube1_yaw + yaw      



   Endif
Else

   

   If dib_pivot1 = 0
   If w_go
      If KeyDown (k_links) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg))Then  cam0_x = cam0_x - cam0_move_x
      If KeyDown (k_rechts) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg)) Then  cam0_x = cam0_x + cam0_move_x
      If KeyDown (k_unten) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg)) Then  cam0_y = cam0_y - cam0_move_y
      If KeyDown (k_oben)  And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg)) Then  cam0_y = cam0_y + cam0_move_y
   ;Vorwärts rückwärts
      If KeyDown (k_lshift) And KeyDown(k_oben)  Then cam0_z = cam0_z + cam0_move_z
      If KeyDown (k_lshift) And KeyDown (k_unten)  Then cam0_z = cam0_z - cam0_move_z
   ;Drehen
      If KeyDown (k_lstrg) And KeyDown (k_unten)  Then cam0_pitch = cam0_pitch - (pitch-0.1); minus 0.1 damits etwas langsammer geht
      If KeyDown (k_lstrg) And KeyDown (k_oben) Then cam0_pitch = cam0_pitch + (pitch-0.1)
      If KeyDown (k_lstrg) And KeyDown (k_links)  Then cam0_yaw = cam0_yaw - yaw
      If KeyDown (k_lstrg) And KeyDown (k_rechts)  Then cam0_yaw = cam0_yaw + yaw
   Endif

   Else

   If w_go
   
      If  KeyDown (k_s)  Then pivot1_pitch = pivot1_pitch - pitch
      If  KeyDown (k_w) Then pivot1_pitch = pivot1_pitch + pitch
      If  KeyDown (k_a)  Then pivot1_yaw = pivot1_yaw - yaw
      If  KeyDown (k_d)  Then pivot1_yaw = pivot1_yaw + yaw
      
   Endif
   Endif
Endif

End Function




scancodekey.bb
Code: [AUSKLAPPEN]

.Tastatur_variablen

Const k_esc  =  1
Const k_1  =  2
Const k_2  =  3
Const k_3  =  4
Const k_4  =  5
Const k_5  =  6
Const k_6  =  7
Const k_7  =  8
Const k_8  =  9
Const k_9  =  10
Const k_0  =  11
Const k_ss  =  12
;const k_  =  13
Const k_backspace  =  14
Const k_tab  =  15
Const k_q  =  16
Const k_w  =  17
Const k_e  =  18
Const k_r  =  19
Const k_t  =  20
Const k_z  =  21
Const k_u  =  22
Const k_i =  23
Const k_o  =  24
Const k_p  =  25
Const k_ue  =  26
Const k_plus  =  27
Const k_return  =  28
Const k_lstrg  =  29
Const k_a  =  30
Const k_s  =  31
Const k_d  =  32
Const k_f  =  33
Const k_g  =  34
Const k_h  =  35
Const k_j  =  36
Const k_k  =  37
Const k_l  =  38
Const k_oe  =  39
Const k_ae  =  40
;const k_  =  41
Const k_lshift  =  42
Const k_sharp  =  43
Const k_y  =  44
Const k_x  =  45
Const k_c  =  46
Const k_v  =  47
Const k_b  =  48
Const k_n  =  49
Const k_m  =  50
Const k_komma  =  51
Const k_punkt  =  52
Const k_minus  =  53
Const k_rshift  =  54
Const k_nummulti  =  55
Const k_lalt  =  56
Const k_space  =  57
Const k_festelltaste  =  58
Const k_f1  =  59
Const k_f2  =  60
Const k_f3  =  61
Const k_f4  =  62
Const k_f5  =  63
Const k_f6  =  64
Const k_f7  =  65
Const k_f8  =  66
Const k_f9  =  67
Const k_f10  =  68
Const k_numlook  =  69
Const k_rollen  =  70
Const k_num7  =  71
Const k_num8  =  72
Const k_num9  =  73
Const k_numminus  =  74
Const k_num4  =  75
Const k_num5  =  76
Const k_num6  =  77
Const k_numplus  =  78
Const k_num1  =  79
Const k_num2  =  80
Const k_num3  =  81
Const k_num0  =  82
Const k_numkomma  =  83
;const k_  =  86
Const k_f11  =  87
Const k_f12  =  88
;const k_  =  153
Const k_numreturn  =  156
Const k_rstrg  =  157
;const k_  =  160
;const k_  =  161
;const k_  =  162
;const k_  =  164
;const k_  =  174
;const k_  =  176
;const k_  =  178
Const k_numdiv  =  181
;const k_  =  183
Const k_ralt  =  184
Const k_pause  =  197
Const k_pos1  =  199
Const k_oben  =  200
Const k_bildrauf  =  201
Const k_links  =  203
Const k_rechts  =  205
Const k_ende  =  207
Const k_unten  =  208
Const k_bildrunter  =  209
Const k_einfügen  =  210
Const k_entfernen  =  211
;const k_  =  219
;const k_  =  220
;const k_  =  221
;const k_  =  222
;const k_  =  223
;const k_  =  227
;const k_  =  229
;const k_  =  230
;const k_  =  231
;const k_  =  232
;const k_  =  233
;const k_  =  234
;const k_  =  235
;const k_  =  236
;const k_  =  237

;----------------------------------------------------------
.Joypad_variablen


.mous_variablen




global.bb
Code: [AUSKLAPPEN]


;Variablen für einen Timer
   Global timer,timer_temp

;Variablen für den Würfeltimer
   Global w_timer,w_go
   Global w_run = 5

;Variabeln für die Frame ausgabe
   Global fps,fps_count

;Variablen für den Würfel als float !!!
Global cube1_x# = 4.0
Global cube1_y# = 0.0
Global cube1_z# = 7.0
Global cube1_move_x# = 0.02
Global cube1_move_y# = 0.02
Global cube1_move_z# = 0.02
Global cube1_pitch# = 0.0
Global cube1_yaw# = 0.0
Global cube1_roll# = 0.0

;Variablen werden für Würfel und Kammera genutzt
Global Pitch# = 0.5
Global yaw# = 0.5
Global roll# = 0.5

;Variablen für die Kammera
Global cam0_x# = 0.0
Global cam0_y# = 0.0
Global cam0_z# = -0.5
Global cam0_move_x# = 0.02
Global cam0_move_y# = 0.02
Global cam0_move_z# = 0.02
Global cam0_pitch# = 0.0
Global cam0_yaw# = 0.0
Global cam0_roll# = 0.0


;Variablen für pivot
Global pivot1_x# = 0.0
Global pivot1_y# = 0.0
Global pivot1_z# = 0.0
Global pivot1_move_x# = 0.02
Global pivot1_move_y# = 0.02
Global pivot1_move_z# = 0.02
Global pivot1_pitch# = 0.0
Global pivot1_yaw# = 0.0
Global pivot1_roll# = 0.0


;Variablen für Kontrollschallter
Global dib_steuerung = 0
Global dib_pivot1
AMD2500XP, SB5.1, DX9, 512MB DDR333,
XPPro SP1a,ATI 9800SE 256bit 128MB,B3B, B+ immer die neue Version

jungle

BeitragDo, Jul 22, 2004 13:06
Antworten mit Zitat
Benutzer-Profile anzeigen
hi,

ich habe die w,s,a,d keyabfrage mit in die _dib-pivot1_ abfrage eingehängt.
anschliessend konnte ich unter _kamerasteuerung_ die kamera auch
bewegen. keine ahnung ob ich das richtig verstanden habe Question

cya


Code: [AUSKLAPPEN]

;-----------------------------------------------------------------
.s_include_scancodekey.bb
Include "scancodekey.bb"
Include "global.bb"
;-----------------------------------------------------------------
.s_graphics
Graphics3D 800,600,16,2
;-----------------------------------------------------------------
.s_setbuffer_backbuffer
SetBuffer (BackBuffer ())
;-----------------------------------------------------------------
.s_hintergrund_laden
;Global bild1 = LoadImage ("2dback.jpg")
;-----------------------------------------------------------------
;-----------------------------------------------------------------
.s_sphere
;Kugel=CREATESPHERE ([Segmente] [,Parent])
Global sphere1 = CreateSphere (8)
PositionEntity sphere1,0.0,0.0,7.0

;-----------------------------------------------------------------
.s_pivot1
Global pivot1=CreatePivot()
PositionEntity pivot1,Pivot1_x,Pivot1_y,Pivot1_z



;-----------------------------------------------------------------
.s_kammera
Global cam0 = CreateCamera(pivot1)
PositionEntity cam0,0.0,0.0,-3.5,1
;CameraProjMode cam0,1 ;<<<<<<<<<<<<<<<<<<<<<<<<test Neu dazu gekommen
;CameraZoom cam0,0.2 ;<<<<<<<<<<<<<<<<<<<<<<<<test Neu dazu gekommen
;----------------------------------------------------------------
.s_licht
Global licht = CreateLight (1)
;-----------------------------------------------------------------
.s_cube
Global cube1 = CreateCube ()
PositionEntity cube1,0.0,0.0,7.0
RotateEntity cube1,45,45,0
EntityColor cube1,200,0,100


;Bild=CreateImage (Breite, Höhe [,Frames] [,Modus])
;Global my_buffer = CreateImage (800,600,1)
; MaskImage my_buffer,0,0,0


.s_while
While Not KeyHit (k_esc)
;......................................
.s_timer
timer = MilliSecs()
.s_fps
fps_count = fps_count + 1
If (timer - timer_temp)>1000
timer_temp = Timer
fps = fps_count
fps_count = 0
Endif
;......................................
.s_w_timer
If (timer-w_timer)> w_run
w_go = 1
w_timer = Timer
Else
w_go = 0
EndIf
;........................................

.s_f_steuerung






;........................................
.s_cube1_position
PositionEntity cube1,cube1_x,cube1_y,cube1_z
.s_cube1_rotate

RotateEntity cube1,cube1_pitch,cube1_yaw,cube1_roll



.s_cam0_position
PositionEntity cam0,cam0_x,cam0_y,cam0_z
.s_cam0_rotate
RotateEntity cam0,cam0_pitch,cam0_yaw,cam0_roll

.s_pivot1_rotate
RotateEntity Pivot1,Pivot1_pitch,Pivot1_yaw,Pivot1_roll
;......................................
f_steuerung()





UpdateWorld ()
RenderWorld ()

;.......................................................
;CopyRect X1, Y1, Breite, Höhe, X2, Y2 [,Quelle] [,Ziel]
;CopyRect 0,0,800,600,0,0,BackBuffer(),ImageBuffer(my_buffer)
;.s_2d_draw
;;DrawBlock bild1,0,0
;DrawImage my_buffer,0,0

;.......................
.s_Text_ausgabe
Text 10,10,"Das Spiel läuft mit "+fps+" Frames in der Sekunde"
If dib_steuerung = 0
Text 10,20,"Würfelsteuerung"

Else
Text 10,20,"Kammerasteuerung"
If dib_pivot1 = 1
Text 10,30,"Pivotachse aktive"
Else
Text 10,30,"Pivotachse nicht aktive"
EndIf
EndIf

Text 60,50,Pivot1_pitch
.s_flip
Flip 1
;...................
.s_cls
Cls


;...................
.s_wend
Wend
End


;=================================================================================

Function f_steuerung()
.s_Steuerungsschalter
If KeyHit (k_space) Then dib_steuerung = Not dib_steuerung
If KeyHit(k_b) Then dib_pivot1 = Not dib_pivot1
;Hier wird einfach zwischen 0 und 1 geswitcht


.s_wuerfel_Steuerung

If dib_steuerung = 0
If w_go
;Links oben unten rechts
If KeyDown (k_links) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg))Then cube1_x = cube1_x - cube1_move_x
If KeyDown (k_rechts) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg)) Then cube1_x = cube1_x + cube1_move_x
If KeyDown (k_unten) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg)) Then cube1_y = cube1_y - cube1_move_y
If KeyDown (k_oben) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg)) Then cube1_y = cube1_y + cube1_move_y
;Vorwärts rückwärts
If KeyDown (k_lshift) And KeyDown(k_oben) Then cube1_z = cube1_z + cube1_move_z
If KeyDown (k_lshift) And KeyDown (k_unten) Then cube1_z = cube1_z - cube1_move_z
;Drehen
If KeyDown (k_lstrg) And KeyDown (k_unten) Then cube1_pitch = cube1_pitch - pitch
If KeyDown (k_lstrg) And KeyDown (k_oben) Then cube1_pitch = cube1_pitch + pitch
If KeyDown (k_lstrg) And KeyDown (k_links) Then cube1_yaw = cube1_yaw - yaw
If KeyDown (k_lstrg) And KeyDown (k_rechts) Then cube1_yaw = cube1_yaw + yaw



EndIf
Else



If dib_pivot1 = 0
If w_go
If KeyDown (k_links) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg))Then cam0_x = cam0_x - cam0_move_x
If KeyDown (k_rechts) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg)) Then cam0_x = cam0_x + cam0_move_x
If KeyDown (k_unten) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg)) Then cam0_y = cam0_y - cam0_move_y
If KeyDown (k_oben) And (Not KeyDown (k_lshift)) And (Not KeyDown (k_lstrg)) Then cam0_y = cam0_y + cam0_move_y
;Vorwärts rückwärts
If KeyDown (k_lshift) And KeyDown(k_oben) Then cam0_z = cam0_z + cam0_move_z
If KeyDown (k_lshift) And KeyDown (k_unten) Then cam0_z = cam0_z - cam0_move_z
;Drehen
If KeyDown (k_lstrg) And KeyDown (k_unten) Then cam0_pitch = cam0_pitch - (pitch-0.1); minus 0.1 damits etwas langsammer geht
If KeyDown (k_lstrg) And KeyDown (k_oben) Then cam0_pitch = cam0_pitch + (pitch-0.1)
If KeyDown (k_lstrg) And KeyDown (k_links) Then cam0_yaw = cam0_yaw - yaw
If KeyDown (k_lstrg) And KeyDown (k_rechts) Then cam0_yaw = cam0_yaw + yaw

If KeyDown (k_s) Then pivot1_pitch = pivot1_pitch - pitch
If KeyDown (k_w) Then pivot1_pitch = pivot1_pitch + pitch
If KeyDown (k_a) Then pivot1_yaw = pivot1_yaw - yaw
If KeyDown (k_d) Then pivot1_yaw = pivot1_yaw + yaw
EndIf

Else

If w_go

;If KeyDown (k_s) Then pivot1_pitch = pivot1_pitch - pitch
;If KeyDown (k_w) Then pivot1_pitch = pivot1_pitch + pitch
;If KeyDown (k_a) Then pivot1_yaw = pivot1_yaw - yaw
;If KeyDown (k_d) Then pivot1_yaw = pivot1_yaw + yaw

EndIf
EndIf
EndIf

End Function

Slayer

BeitragDo, Jul 22, 2004 13:25
Antworten mit Zitat
Benutzer-Profile anzeigen
Danke erst mal das Du mir versuchst zu helfen Smile

Das Problem ist aber das gleiche,
Wenn ich die "wasd" steuerung benutze bewegen sich die sphere und der cube um die kamera, so soll das nur bei der bewegung der Kamera selber sein.
Mit der "wasd" müsste sich die Kamera um das Pivot drehen, damit man es besser erkennt habe ich eine sphere auf den pivot koordinaten plaziert.

Hast Du dir mal den ersten code angeschaut ? genauso sollte es laufen.

Vieleicht habe ich irgendwo im code nen schreibfehler, ich kann ihn aber nicht finden

Crying or Very sad .
AMD2500XP, SB5.1, DX9, 512MB DDR333,
XPPro SP1a,ATI 9800SE 256bit 128MB,B3B, B+ immer die neue Version

eizdealer

BeitragDo, Jul 22, 2004 15:51
Antworten mit Zitat
Benutzer-Profile anzeigen
Warum machst du das nicht mit Sin / Cos?

Aus meinem "Archiv":
Code: [AUSKLAPPEN]
   X# = Sin(CamRotX) * ( Cos(CamRotY) * CamZoom )
   Y# = Sin(CamRotY) * CamZoom
   Z# = X / Tan(CamRotX)
   If CamRotX = 0 Then Z = Cos(CamRotY) * CamZoom
   
   PositionEntity Camera,EntityX(CameraPivot) + X,EntityY(CameraPivot) + Y,EntityZ(CameraPivot) + Z
   
   PointEntity Camera,CameraPivot


Die Variablen sollten einleuchtend sein:
CamRotX = Horizontale Kamerarotation
CamRotY = Vertikale Kamerarotation
CamZoom = Kamerazoom
Die Kamera schaut immer auf den CameraPivot.
Jetzt musst du also nur noch den CameraPivot an den Zielpunkt setzen und die Variablen entsprechend setzen.

Hoffe ich konnte dir helfen Smile

Slayer

BeitragDo, Jul 22, 2004 16:02
Antworten mit Zitat
Benutzer-Profile anzeigen
Danke eizdealer,
werds mal testen.

Ich bin gar nicht auf die Idee gekommen dafür selber was zuschreiben Embarassed

Trotzdem würds mich schon interesiern warums in meinem Code nicht läuft.

Naja, vieleicht liegts auch daran das ich erkältet daheim sitz und keinen klaren Kopf habe Wink
AMD2500XP, SB5.1, DX9, 512MB DDR333,
XPPro SP1a,ATI 9800SE 256bit 128MB,B3B, B+ immer die neue Version

Neue Antwort erstellen


Übersicht BlitzBasic Blitz3D

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group