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

74 lines
2.0 KiB
HTML

<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>CreatePivot ( [parent] )</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
parent (optional) - parent entity of pivot
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Creates a pivot entity.
<br />
<br />
A pivot entity is an invisible point in 3D space that's main use is to act as a parent entity to other entities. The pivot can then be used to control lots of entities at once, or act as new centre of rotation for other entities.
<br />
<br />
To enforce this relationship; use EntityParent or make use of the optional parent entity parameter available with all entity load/creation commands.
<br />
<br />
Indeed, this parameter is also available with the CreatePivot command if you wish for the pivot to have a parent entity itself.
</td>
</tr>
</table>
<h1><a href=../3d_examples/CreatePivot.bb>Example</a></h1>
<table>
<tr>
<td>
; CreatePivot Example
<br />
; -------------------
<br />
<br />
Graphics3D 640,480
<br />
SetBuffer BackBuffer()
<br />
<br />
camera=CreateCamera()
<br />
PositionEntity camera,0,0,-10
<br />
<br />
light=CreateLight()
<br />
RotateEntity light,90,0,0
<br />
<br />
; Create pivot. This is invisible.
<br />
pivot=CreatePivot()
<br />
<br />
; Create planet (i.e. a sphere). Make the pivot the parent of the planet.
<br />
planet=CreateSphere(16,pivot)
<br />
<br />
; Position planet so that it is offset from the pivot
<br />
PositionEntity planet,5,0,0
<br />
<br />
While Not KeyDown(1)
<br />
<br />
; Turn pivot, thus making planet spin around it
<br />
TurnEntity pivot,0,1,0
<br />
<br />
RenderWorld
<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=CreatePivot&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
</html>