|
entity - entity handle global (optional) - true to return the roll angle in world space, false to return it relative to the entity's parent; false (default) |
|
Returns the roll angle of an entity, in degrees. Roll is the entity's z-axis rotation - tilting left and right, like a plane banking into a turn. It is the third angle you pass to RotateEntity and TurnEntity. With global false (the default) the angle is relative to the entity's parent; pass true for the entity's orientation in the world. For an entity with no parent the two are the same. See also: EntityPitch, EntityYaw, RotateEntity, TurnEntity. |
; EntityRoll Example
; ------------------
Graphics3D 640,480,0,2
SetBuffer BackBuffer()
camera=CreateCamera()
PositionEntity camera,0,0,-5
light=CreateLight()
RotateEntity light,45,45,0
; A dart we can tumble with the keyboard
dart=CreateCone(16)
EntityColor dart,255,100,0
While Not KeyDown(1)
; Cursor keys pitch and yaw the dart, Z/X roll it
pitch#=0
yaw#=0
roll#=0
If KeyDown(208) Then pitch=-1
If KeyDown(200) Then pitch=1
If KeyDown(203) Then yaw=-1
If KeyDown(205) Then yaw=1
If KeyDown(44) Then roll=-1
If KeyDown(45) Then roll=1
TurnEntity dart,pitch,yaw,roll
RenderWorld
Text 0,0,"Cursors: pitch/yaw Z/X: roll Esc: exit"
; EntityRoll returns the entity's current rotation about its z axis
Text 0,20,"EntityRoll(dart) = "+EntityRoll(dart)
Text 0,40,"(pitch = "+EntityPitch(dart)+" yaw = "+EntityYaw(dart)+")"
Flip
Wend
End