Skip to content

CopyEntity

Narta Xaymar Dirks edited this page Oct 28, 2026 · 6 revisions
Blitz3D

CopyEntity

CopyEntity:Int32 entity:Int32, parent:Int32=0
Parameter Mode Type Default Description
entity In Int32 required Entity handle to copy.
parent In Int32 0 Entity the copy follows, or 0 for none. Defaults to 0.

Returns: The handle of the copy.

Description

Makes a new entity from an existing one and returns its handle. The copy shares the original's mesh, so changing the mesh itself, for example with RotateMesh or by adding vertices, changes every copy. Entity properties such as position, rotation, scale, color and alpha belong to each copy and can be changed apart. Children are copied too, in the order they became children. A camera, a light or a terrain has no copy: CopyEntity makes a pivot with the same name, place and collision settings instead. A copy of a hidden entity is visible, which is how a hidden original can serve as a template. Copying is much cheaper than loading the same file again.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
PositionEntity camera, 0, 2, -7
RotateEntity camera, 15, 0, 0
light = CreateLight()
RotateEntity light, 45, 45, 0
original = CreateCube()
HideEntity original
For i = 0 To 4
	copy = CopyEntity(original)
	PositionEntity copy, i * 2 - 4, 0, 0
	ScaleEntity copy, 0.5 + i * 0.2, 0.5 + i * 0.2, 0.5 + i * 0.2
	EntityColor copy, 60 + i * 40, 200 - i * 30, 120
Next
RenderWorld
Flip
WaitKey

Media

CopyEntity

Related Commands

FreeEntity, HideEntity, MoveEntity, NameEntity, PaintEntity, PointEntity, PositionEntity, RotateEntity

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally