automatische gegenbewegung
Übersicht

![]() |
monkfurtsBetreff: automatische gegenbewegung |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich habe ein Flugzeug in b3d geladen.
das Flugzeug hat 2 Seitenruder (1 links 1 rechts). ![]() Wenn man taste nach links drückt drehen sie sich in die linke richtung und rechte taste nach rechts das ganze ist auf 30 ° in jede Richtung(y) begrenzt. Jedes ruder hat einen pivot als Achse. jetzt möchte ich noch das sich die ruder automatisch langsam auf 0 zurücksetzen wenn man nichts drückt aktueller Code: [AUSKLAPPEN] If EntityYaw(mfsachse1) > 0 Then
If Not KeyDown(seitekey) = 1 Then TurnEntity mfsachse1,0,-2,0 EndIf EndIf If EntityYaw(mfsachse1) < 0 Then If Not KeyDown(nseitekey) = 1 Then TurnEntity mfsachse1,0,2,0 EndIf EndIf Problem ist nur das sich das sich die der Pivot zu weit dreht also über 0 hinaus auf werte wie 4.9092e-006 ändert und ich weis nicht wie sich das vermeiden läst. bitte um hilfe |
||
win 7 ultimate 64-bit | core i7 2600k 4x3,4 ghz | nvidia gtx 560-ti oc | 6gb ram |
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ich würde auf TurnEntity verzichten und stattdessen RotateEntity![]() |
||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
![]() |
monkfurts |
![]() Antworten mit Zitat ![]() |
---|---|---|
Ja das würde funktionieren.
Allerdings will ich ja das sich das ruder bewegt und nicht einfach innerhalb von einem Frame auf 0 springt . |
||
win 7 ultimate 64-bit | core i7 2600k 4x3,4 ghz | nvidia gtx 560-ti oc | 6gb ram |
![]() |
XeresModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
Es spricht nichts dagegen den Wert zu verkleinern, nur eben nicht so kontrolllos wie mit Turnentity. | ||
Win10 Prof.(x64)/Ubuntu 16.04|CPU 4x3Ghz (Intel i5-4590S)|RAM 8 GB|GeForce GTX 960
Wie man Fragen richtig stellt || "Es geht nicht" || Video-Tutorial: Sinus & Cosinus THERE IS NO FAIR. THERE IS NO JUSTICE. THERE IS JUST ME. (Death, Discworld) |
bjh |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
und wenn er in einem bestimmten bereich ist, dann einfach auf 0 setzen.
dann gibt es auch keine komischen zahlen. |
||
![]() |
Brotenkopf |
![]() Antworten mit Zitat ![]() |
---|---|---|
also ich würde es so machen in der Mainschleife
Code: [AUSKLAPPEN] md1=MouseDown(1) md2=MouseDown(2) If md1=1 Or md2=1 Then If md1 And rota#<30 Then rota=rota+.5 If md2 And rota#>-30 Then rota=rota-.5 Else If rota>0 Then rota=rota-.5 If rota<0 Then rota=rota+.5 End If RotateEntity mfachse1,0,rota,0 Also für md1 und md2 kannst natürlich halt deine Keys benutzen |
||
![]() |
monkfurts |
![]() Antworten mit Zitat ![]() |
---|---|---|
ok danke, habs jetzt mit dem code geschaft
Code: [AUSKLAPPEN] If KeyDown(seitekey)=1 Or KeyDown(nseitekey)=1 Then
If KeyDown(seitekey) And EntityYaw(mfsachse1)<30 Then RotateEntity mfsachse1,0,EntityYaw(mfsachse1)+.5,0 If KeyDown(nseitekey) And EntityYaw(mfsachse1)>-30 Then RotateEntity mfsachse1,0,EntityYaw(mfsachse1)-.5,0 Else If EntityYaw(mfsachse1)>0 Then RotateEntity mfsachse1,0,EntityYaw(mfsachse1)-.5,0 If EntityYaw(mfsachse1)<0 Then RotateEntity mfsachse1,0,EntityYaw(mfsachse1)+.5,0 If EntityYaw(mfsachse1)>-1 And EntityYaw(mfsachse1) < 1 Then RotateEntity mfsachse1,0,0,0 End If If KeyDown(seitekey)=1 Or KeyDown(nseitekey)=1 Then If KeyDown(seitekey) And EntityYaw(mfsachse2)<30 Then RotateEntity mfsachse2,0,EntityYaw(mfsachse2)+.5,0 If KeyDown(nseitekey) And EntityYaw(mfsachse2)>-30 Then RotateEntity mfsachse2,0,EntityYaw(mfsachse2)-.5,0 Else If EntityYaw(mfsachse2)>0 Then RotateEntity mfsachse2,0,EntityYaw(mfsachse2)-.5,0 If EntityYaw(mfsachse2)<0 Then RotateEntity mfsachse2,0,EntityYaw(mfsachse2)+.5,0 If EntityYaw(mfsachse2)>-1 And EntityYaw(mfsachse2) < 1 Then RotateEntity mfsachse2,0,0,0 End If |
||
win 7 ultimate 64-bit | core i7 2600k 4x3,4 ghz | nvidia gtx 560-ti oc | 6gb ram |
![]() |
Brotenkopf |
![]() Antworten mit Zitat ![]() |
---|---|---|
Du könntest noch die Rotation der mfachse1 und mfachse2 zusammenfassen da sie ja scheinbar die gleiche bewegung ausführen sollen. Wozu ist das? Code: [AUSKLAPPEN] If EntityYaw(mfsachse2)>-1 And EntityYaw(mfsachse2) < 1 Then RotateEntity mfsachse2,0,0,0 die Achse sollte doch von alleine wieder auf 0 zurückgesetzt werden.
|
||
bjh |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
es gibt aber oft "floatfehler". dann steht immer eine komische zahl dran.
beim testen ist das besser so, aber im richtigen spiel wird das nicht mehr notwendig sein. |
||
![]() |
Brotenkopf |
![]() Antworten mit Zitat ![]() |
---|---|---|
du kannst auch floor(rotation) zB verwenden dann werden die zahlen abgerundet. | ||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group