Hilfe
EntityPitch
Aufruf
Parameter
Rückgabewert
Beschreibung
Beispiel
Siehe auch
WinkelX# = EntityPitch# (Entity [,Global])
Parameter
Entity | Identität eines Entitys |
Global |
0=absolut (Standard)
1=relativ |
Rückgabewert
Es wird ein Winkel (in Grad) zur X-Achse zurückgeliefert (Nur Winkel -90 bis +90).
Beschreibung
Die Funktion EntityPitch ermittelt den Drehwinkel eines Objekts (X-Achse).
Dazu muss man zuerst die Identität eines Entitys angeben. Der optionale Parameter "Global" gibt an, ob ein absoluter oder relativer Winkel ausgegeben werden soll. Ein absoluter Winkel ist immer auf das globale 3D-Koordinatensystem ausgerichtet. Ein relativer Winkel ist dagegen abhängig von den Drehwinkeln eines Parent-Objekts.
Siehe auch EntityRoll (Z-Achse) und EntityYaw
(Y-Achse).
Beispiel
Dieses Programm erstellt ein Kegelobjekt, welches danach gedreht werden kann. Die Winkel werden zusätzlich angezeigt:
Graphics3D 640, 480
SetBuffer BackBuffer()
camera = CreateCamera()
light = CreateLight()
cone = [CreateCone(32)
PositionEntity cone, 0, 0, 5
While Not KeyDown(1)
pitch#=0
yaw#=0
roll#=0
If KeyDown(208) = 1 Then pitch# = -1
If KeyDown(200) = 1 Then pitch# = 1
If KeyDown(203) = 1 Then yaw# = -1
If KeyDown(205) = 1 Then yaw# = 1
If KeyDown(45) = 1 Then roll# = -1
If KeyDown(44) = 1 Then roll# = 1
TurnEntity cone, pitch#, yaw#, roll#
RenderWorld
Text 0, 0, "Benutze Cursortasten und Z/X"
Text 0, 20, "Pitch: "+ EntityPitch#(cone)
Text 0, 40, "Yaw: "+ EntityYaw#(cone)
Text 0, 60, "Roll: "+ EntityRoll#(cone)
Flip
Wend
End
SetBuffer BackBuffer()
camera = CreateCamera()
light = CreateLight()
cone = [CreateCone(32)
PositionEntity cone, 0, 0, 5
While Not KeyDown(1)
pitch#=0
yaw#=0
roll#=0
If KeyDown(208) = 1 Then pitch# = -1
If KeyDown(200) = 1 Then pitch# = 1
If KeyDown(203) = 1 Then yaw# = -1
If KeyDown(205) = 1 Then yaw# = 1
If KeyDown(45) = 1 Then roll# = -1
If KeyDown(44) = 1 Then roll# = 1
TurnEntity cone, pitch#, yaw#, roll#
RenderWorld
Text 0, 0, "Benutze Cursortasten und Z/X"
Text 0, 20, "Pitch: "+ EntityPitch#(cone)
Text 0, 40, "Yaw: "+ EntityYaw#(cone)
Text 0, 60, "Roll: "+ EntityRoll#(cone)
Flip
Wend
End
Siehe auch

