Skip to content

DeltaYaw

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

DeltaYaw

DeltaYaw:Float32 src_entity:Int32, dest_entity:Int32
Parameter Mode Type Default Description
src_entity In Int32 required The entity that should turn.
dest_entity In Int32 required The entity it should look at.

Returns: The turn needed, in degrees.

Description

Tells you how far an entity has to turn around its vertical axis to look at another entity. The result is in degrees, between -180 and 180. A positive angle is a turn to the left, as with EntityYaw, so adding the result to the current yaw makes the entity face the target. It only looks at the horizontal direction; the height difference is covered by DeltaPitch.

Examples

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

turret = CreatePivot()
target = CreatePivot()
PositionEntity target, 5, 0, 5

; The target is up front and to the right, so the turret turns right by 45 degrees (-45).
TurnEntity turret, DeltaPitch(turret, target), DeltaYaw(turret, target), 0
Text 8, 8, "Yaw: " + EntityYaw(turret) + "  Pitch: " + EntityPitch(turret)
Flip
WaitKey

Related Commands

DeltaPitch, ProjectedX, ProjectedY, VectorYaw

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally