Blitz3D+ Command Reference

EntityPitch# ( entity[,global] )

Parameters

entity - entity handle

global (optional) - true to return the pitch angle in world space, false to return it relative to the entity's parent; false (default)

Description

Returns the pitch angle of an entity, in degrees.

Pitch is the entity's x-axis rotation - tilting forwards and backwards, like nodding your head. It is the first angle you pass to RotateEntity and TurnEntity, so EntityPitch is how you read back what those commands set.

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: EntityYaw, EntityRoll, RotateEntity, TurnEntity.

Example

; EntityPitch 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"
    ; EntityPitch returns the entity's current rotation about its x axis
    Text 0,20,"EntityPitch(dart) = "+EntityPitch(dart)
    Text 0,40,"(yaw = "+EntityYaw(dart)+"   roll = "+EntityRoll(dart)+")"

    Flip

Wend

End

Index