Skip to content

TFormNormal

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

TFormNormal

TFormNormal:Void x:Float32, y:Float32, z:Float32, source_entity:Int32, dest_entity:Int32
Parameter Mode Type Default Description
x In Float32 required X of the normal in the source space.
y In Float32 required Y of the normal in the source space.
z In Float32 required Z of the normal in the source space.
source_entity In Int32 required Entity whose space the normal is in, or 0 for the world.
dest_entity In Int32 required Entity whose space the result should be in, or 0 for the world.

Description

Converts a surface normal from one space to another, and makes the result exactly 1 unit long again. Where TFormVector would stretch a direction with the scale of the entity, a normal keeps its length, which is what lighting and bouncing calculations need. The result is read back with TFormedX, TFormedY and TFormedZ.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()

ramp = CreateCube()
RotateEntity ramp, 0, 0, 30
ScaleEntity ramp, 4, 1, 1

; The top of the cube points up in its own space; in the world it is tilted.
TFormNormal 0, 1, 0, ramp, 0
Text 8, 8, "Top normal: " + TFormedX() + ", " + TFormedY() + ", " + TFormedZ()
Flip
WaitKey

Related Commands

TFormedX, TFormedY, TFormedZ, TFormPoint, TFormVector

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally