entity - name of entity to be rotated pitch# - angle in degrees that entity will be pitched yaw# - angle in degrees that entity will be yawed roll# - angle in degrees that entity will be rolled global (optional) - |
Turns an entity relative to its current orientation. Pitch is the same as the x angle of an entity, and is equivalent to tilting forward/backwards. Yaw is the same as the y angle of an entity, and is equivalent to turning left/right. Roll is the same as the z angle of an entity, and is equivalent to tilting left/right. See also: dxRotateEntity, dxRotateMesh. |
; dxTurnEntity Example ; ------------------ dxGraphics3D 640,480 dxSetBuffer dxBackBuffer() camera=dxCreateCamera() light=dxCreateLight() cone=dxCreateCone( 32 ) dxPositionEntity cone,0,0,5 While Not dxKeyDown( 1 ) ; Reset turn values - otherwise, the cone will not stop turning! pitch#=0 yaw#=0 roll#=0 ; Change movement values depending on the key pressed If dxKeyDown( 208 )=True Then pitch#=-1 If dxKeyDown( 200 )=True Then pitch#=1 If dxKeyDown( 203 )=True Then yaw#=-1 If dxKeyDown( 205 )=True Then yaw#=1 If dxKeyDown( 45 )=True Then roll#=-1 If dxKeyDown( 44 )=True Then roll#=1 ; Move sphere using movement values dxTurnEntity cone,pitch#,yaw#,roll# dxRenderWorld dxText 0,0,"Use cursor/Z/X keys to turn cone" dxText 0,20,"Pitch: "+pitch# dxText 0,40,"Yaw: "+yaw# dxText 0,60,"Roll: "+roll# dxFlip Wend End |