TurnEntity entity,pitch#,yaw#,roll#[,global]
Parameters
|
entity - entity handle 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) - true to turn about the world axes rather than the entity's local axes; false (default) |
Description
|
Turns an entity relative to its current orientation. Pitch is the x angle of an entity - tilting forwards and backwards. Yaw is the y angle - turning left and right. Roll is the z angle - tilting left and right. TurnEntity adds to the current orientation, while RotateEntity sets it outright. Call TurnEntity every frame for continuous motion: TurnEntity spinner,0,1,0 slowly spins a pickup, and TurnEntity player,0,-mouse_x_speed,0 steers a character. Use RotateEntity when you know the exact facing you want. See also: RotateEntity, PointEntity, EntityYaw, RotateMesh. |
Example
; TurnEntity Example ; ------------------ Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,0,-5 light=CreateLight() RotateEntity light,45,45,0 ; A dart to steer dart=CreateCone(16) EntityColor dart,255,100,0 While Not KeyDown(1) ; Reset turn values each frame - otherwise the dart would never stop turning pitch#=0 yaw#=0 roll#=0 ; Cursor keys pitch and yaw the dart, Z/X roll it 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 rotates RELATIVE to the current orientation - each call adds ; to the rotation. Compare RotateEntity, which sets an absolute orientation. TurnEntity dart,pitch,yaw,roll RenderWorld Text 0,0,"Cursors: pitch/yaw Z/X: roll Esc: exit" Text 0,20,"TurnEntity dart,"+pitch+","+yaw+","+roll+" (added every frame)" Text 0,40,"Current angles: pitch "+EntityPitch(dart)+" yaw "+EntityYaw(dart)+" roll "+EntityRoll(dart) Flip Wend End
Index