CreatePlane ( [segments][,parent] )

Parameters

segments (optional) - sub divisions of plane, in the range 1-20; 1 (default)

parent (optional) - parent entity of plane

Description

Creates a plane entity and returns its handle.

A plane entity is a flat, infinite 'ground'. It is useful for outdoor games where you never want the player to see or reach the edge of the game world - texture it with a ground texture and you have instant terrain to stand things on.

The optional segments parameter determines how many sub divisions of polygons the plane will have (the range is checked in debug mode only). A plane is flat, so extra polygons will not make it smoother. In Original mode they give more vertices for detailed lighting across the ground. Extended mode lights each pixel, so extra segments are not needed just to improve lighting detail.

The optional parent parameter allows you to specify a parent entity for the plane, so that when the parent moves the plane moves with it. The relationship is one way: applying movement commands to the child will not affect the parent. Specifying a parent will still result in the plane being created at position 0,0,0 rather than at the parent entity's position.

See also: CreateMirror, CreateCube, EntityTexture.

Example

; CreatePlane Example
; -------------------

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

camera=CreateCamera()
PositionEntity camera,0,1,-5

light=CreateLight()
RotateEntity light,45,45,0

; Create the infinite ground plane and texture it
plane=CreatePlane()
ground_tex=LoadTexture("media/MossyGround.BMP")
EntityTexture plane,ground_tex

; A spinning cone landmark so movement over the plane is easy to see
cone=CreateCone(16)
PositionEntity cone,0,1,5
EntityColor cone,255,100,0

While Not KeyDown(1)

    TurnEntity cone,0,1,0

    ; Arrow keys move the camera
    If KeyDown(200) Then MoveEntity camera,0,0,0.1
    If KeyDown(208) Then MoveEntity camera,0,0,-0.1
    If KeyDown(203) Then TurnEntity camera,0,1,0
    If KeyDown(205) Then TurnEntity camera,0,-1,0

    RenderWorld

    Text 0,0,"Arrow keys: move camera   Esc: exit"
    Text 0,20,"CreatePlane() makes an infinite ground - you can never reach its edge"

    Flip

Wend

End

Index