dxCreatePivot%(parent%)

Parameters

parent (optional) - parent entity of pivot

Description

Creates a pivot entity.

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.

To enforce this relationship; use dxEntityParent or make use of the optional parent entity parameter available with all entity load/creation commands.

Indeed, this parameter is also available with the dxCreatePivot command if you wish for the pivot to have a parent entity itself.

Example

; dxCreatePivot Example
; -------------------

dxGraphics3D 640,480
dxSetBuffer dxBackBuffer()

camera=dxCreateCamera()
dxPositionEntity camera,0,0,-10

light=dxCreateLight()
dxRotateEntity light,90,0,0

; Create pivot. This is invisible.
pivot=dxCreatePivot()

; Create planet (i.e. a sphere). Make the pivot the parent of the planet.
planet=dxCreateSphere(16,pivot)

; Position planet so that it is offset from the pivot
dxPositionEntity planet,5,0,0

While Not dxKeyDown(1)

; Turn pivot, thus making planet spin around it
dxTurnEntity pivot,0,1,0

dxRenderWorld
dxFlip

Wend

End

Index