Skip to content

TFormNormal

Claude edited this page Oct 27, 2026 · 5 revisions
Blitz3D

TFormNormal

TFormNormal x:Float32, y:Float32, z:Float32, source_entity:Int32, dest_entity:Int32
Parameter Type Default Description
x Float32 required X of the normal in the source space.
y Float32 required Y of the normal in the source space.
z Float32 required Z of the normal in the source space.
source_entity Int32 required Entity whose space the normal is in, or 0 for the world.
dest_entity 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


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

Clone this wiki locally