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

86 lines
2.4 KiB
HTML

<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>RotateEntity entity,pitch#,yaw#,roll#,[,global]</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
entity - name of the entity to be rotated
<br />
pitch# - angle in degrees of pitch rotation
<br />
yaw# - angle in degrees of yaw rotation
<br />
roll# - angle in degrees of roll rotation
<br />
global (optional) - true if the angle rotated should be relative to 0,0,0 rather than a parent entity's orientation. False by default.
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Rotates an entity so that it is at an absolute 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=TurnEntity.htm>TurnEntity</a>, <a class=small href=RotateMesh.htm>RotateMesh</a>.
</td>
</tr>
</table>
<h1><a href=../3d_examples/RotateEntity.bb>Example</a></h1>
<table>
<tr>
<td>
; RotateEntity 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 />
; Change rotation values depending on the key pressed
<br />
If KeyDown( 208 )=True Then pitch#=pitch#-1
<br />
If KeyDown( 200 )=True Then pitch#=pitch#+1
<br />
If KeyDown( 203 )=True Then yaw#=yaw#-1
<br />
If KeyDown( 205 )=True Then yaw#=yaw#+1
<br />
If KeyDown( 45 )=True Then roll#=roll#-1
<br />
If KeyDown( 44 )=True Then roll#=roll#+1
<br />
<br />
; Rotate cone using rotation values
<br />
RotateEntity cone,pitch#,yaw#,roll#
<br />
<br />
RenderWorld
<br />
<br />
Text 0,0,"Use cursor/Z/X keys to change cone rotation"
<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=RotateEntity&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
</html>