Einige Neuligs fragen.
Übersicht

Cyberman016Betreff: Einige Neuligs fragen. |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Bin noch ein neuling auf dem Gebiet 3d-programming, und hab deshalb ein paar fragen:
Ich programmier gerad nen kleinen Ego-Shooter und würd die x und y Drehung der Kamera gern mit der Maus steuern (umgefähr so wie bei GTA), aber irgendwie gelingt mir das nicht so ganz, kennt da irgendwer ne Lösung? Ich brauch noch ein Paar Explosionen hat da irgendwer irgendwelche Funktionen programmiert die das können? |
||
![]() |
YellowRiderEhemaliger Admin |
![]() Antworten mit Zitat ![]() |
---|---|---|
Code: [AUSKLAPPEN] Graphics3D 800,600,16,2
SetBuffer BackBuffer() Global ms=20 Global cx# Global cy# Global player=CreatePivot() PositionEntity player,6,4,-6 EntityRadius player,1.8 EntityType player,1 cube=CreateCube() PositionEntity cube,0,0,10 Global cam=CreateCamera() PositionEntity cam,EntityX(player),EntityY(player)+3,EntityZ(player) While Not KeyHit(1) mouse() PositionEntity cam,EntityX(player),EntityY(player)+3,EntityZ(player) RenderWorld Flip Wend Function mouse() mxs=MouseXSpeed()*ms ;(20) mys=MouseYSpeed()*ms ;(20) cx#=EntityPitch(cam)+mys*0.01 cy#=EntityYaw(cam)-mxs*0.01 If cx#>89 Then cx#=89 If cx#<-89 Then cx#=-89 RotateEntity cam,cx,cy,0 RotateEntity player,EntityPitch(player),cy,0 MoveMouse 400,300 End Function |
||
Master King of |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Code: [AUSKLAPPEN] Global MausX
Global MausY Das kommt in die Hauptschleife: Code: [AUSKLAPPEN] Alte_X_Koordinate = MausX
Alte_Y_Koordinate = MausY MausX = MouseX() MausY = MouseY() If Alte_X_Koordinate < MausX Then TurnEntity Kamera,0,-MausX-Alte_X_Koordinate,0 End If If Alte_X_Koordinate > MausX Then TurnEntity Kamera,0,+Alte_X_Koordinate-MausX,0 End If ________ fos[/code] |
||
Master King of |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Oh war wohl zu voreilig das klappt nur um 360° danach dreht dat nich mehr!!! Kann mir jemand erklären warum das so ist!?!
oda hab ich hier was falsch gemacht??? ;Code: [AUSKLAPPEN] Hauptschleife
Repeat AltMausX = MausX AltMausY = MausY MausX = MouseX() MausY = MouseY() XKoordinate = EntityX(Spielerfigur) YKoordinate = EntityY(Spielerfigur) ZKoordinate = EntityZ(Spielerfigur) ;Steuerung If KeyDown(17) Then MoveEntity Spielerfigur,0,0,+0.03 End If If KeyDown(31) Then MoveEntity Spielerfigur,0,0,-0.03 End If If KeyDown(30) Then MoveEntity Spielerfigur,-0.02,0,0 End If If KeyDown(32) Then MoveEntity Spielerfigur,+0.02,0,0 End If If MausX > AltMausX Then TurnEntity Kamera,0,-((MausX-AltMausX)/3),0 TurnEntity Spielerfigur,0,+((MausX-AltMausX)/3),0 End If If MausX < AltMausX Then TurnEntity Kamera,0,+((AltMausX-Maus)/3),0 TurnEntity Spielerfigur,0,-((AltMausX-MausX)/3),0 End If PositionEntity Kamera,XKoordinate,YKoordinate,ZKoordinate;Kamera positionieren ; ;Map zeichnen Cls RenderWorld Flip ; Until KeyHit(1) |
||
![]() |
Markus2 |
![]() Antworten mit Zitat ![]() |
---|---|---|
@Master King of
Wenn der Mauszeiger am Fenster Rand ist bleibt er stehen . Einfach immer in die Mitte setzen darf man auch nicht sonnst könnte es ruckeln , also muß man da ein wenig tricksen ![]() |
||
Edlothiol |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Warum sollte es dann ruckeln? | ||
Master King of |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Habs ausgeprobiert, ruckelt nich
danke @markus _______ fos |
||
![]() |
Markus2 |
![]() Antworten mit Zitat ![]() |
---|---|---|
@Edlothiol
Könnte dann der Fall sein wenn man MouseSpeed benutzt . Sowas ist mir passiert und habe mich dann tierisch über meine Dummheit geärgert . In einem Projekt ist mir das erst Monate später aufgefallen ![]() |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group