Files
BlitzNext/_release/help/commands/3d_commands/TurnEntity.htm
T
2014-12-08 12:43:20 +13:00

91 lines
2.4 KiB
HTML

<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>TurnEntity entity,pitch#,yaw#,roll#,[,global]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
entity - name of entity to be rotated
<br />
pitch# - angle in degrees that entity will be pitched
<br />
yaw# - angle in degrees that entity will be yawed
<br />
roll# - angle in degrees that entity will be rolled
<br />
global (optional) -
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Turns an entity relative to its current orientation.
<br />
<br />
Pitch is the same as the x angle of an entity, and is equivalent to tilting forward/backwards.
<br />
<br />
Yaw is the same as the y angle of an entity, and is equivalent to turning left/right.
<br />
<br />
Roll is the same as the z angle of an entity, and is equivalent to tilting left/right.
<br>
<br>
See also: <a class=small href=RotateEntity.htm>RotateEntity</a>, <a class=small href=RotateMesh.htm>RotateMesh</a>.
</td>
</tr>
</table>
<h1><a href=../3d_examples/TurnEntity.bb>Example</a></h1>
<table>
<tr>
<td>
; TurnEntity Example
<br />
; ------------------
<br />
<br />
Graphics3D 640,480
<br />
SetBuffer BackBuffer()
<br />
<br />
camera=CreateCamera()
<br />
light=CreateLight()
<br />
<br />
cone=CreateCone( 32 )
<br />
PositionEntity cone,0,0,5
<br />
<br />
While Not KeyDown( 1 )
<br />
<br />
; Reset turn values - otherwise, the cone will not stop turning!
<br />
pitch#=0
<br />
yaw#=0
<br />
roll#=0
<br />
<br />
; Change movement values depending on the key pressed
<br />
If KeyDown( 208 )=True Then pitch#=-1
<br />
If KeyDown( 200 )=True Then pitch#=1
<br />
If KeyDown( 203 )=True Then yaw#=-1
<br />
If KeyDown( 205 )=True Then yaw#=1
<br />
If KeyDown( 45 )=True Then roll#=-1
<br />
If KeyDown( 44 )=True Then roll#=1
<br />
<br />
; Move sphere using movement values
<br />
TurnEntity cone,pitch#,yaw#,roll#
<br />
<br />
RenderWorld
<br />
<br />
Text 0,0,"Use cursor/Z/X keys to turn cone"
<br />
Text 0,20,"Pitch: "+pitch#
<br />
Text 0,40,"Yaw: "+yaw#
<br />
Text 0,60,"Roll: "+roll#
<br />
<br />
Flip
<br />
<br />
Wend
<br />
<br />
End
</td>
</tr>
</table>
<br>
<a target=_top href=../index.htm>Index</a><br>
<br>
Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=TurnEntity&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
</html>