dxDeltaYaw#(src_entity,dest_entity)

Parameters

src_entity - source entity handle
dest_entity - destination entity handle

Description

Returns the yaw angle, that src_entity should be rotated by in order to face dest_entity.

This command can be used to be point one entity at another, rotating on the y axis only.

See also: dxDeltaPitch.

Example

dxSetBuffer dxBackBuffer()

camera=dxCreateCamera()

; Make camera orthagraphic for flat, 2D view
dxCameraProjMode camera,2

; Position and rotate camera so we have overhead (top-down) view
dxPositionEntity camera,0,5,0
dxRotateEntity camera,90,0,0

; Create red cone (the arrow)
arrow=dxCreateCone()
dxRotateMesh arrow,90,180,0
dxScaleMesh arrow,.1,.1,.2
dxEntityColor arrow,255,0,0

; Create blue sphere (the spot)
spot=dxCreateSphere()
dxScaleMesh spot,.1,.1,.1
dxEntityColor spot,0,0,255

While Not dxKeyDown(1)

; If w,a,s,d pressed then move spot
If dxKeyDown(17)=True Then dxMoveEntity spot,0,0,0.01 ; w - up
If dxKeyDown(30)=True Then dxMoveEntity spot,-0.01,0,0 ; a - left
If dxKeyDown(31)=True Then dxMoveEntity spot,0,0,-0.01 ; s - down
If dxKeyDown(32)=True Then dxMoveEntity spot,0.01,0,0 ; d - right

; Rotate arrow using delta yaw value. Arrow will point at spot.
dxRotateEntity arrow,0,dxDeltaYaw#(spot,arrow),0

dxRenderWorld

dxText 0,0,"Note: Camera view is overhead. The arrow will y-rotate using dxDeltaYaw value."
dxText 0,20,"Use w,a,s,d to move spot."
dxText 0,40,"Delta yaw: "+dxDeltaYaw#(spot,arrow)

dxFlip
Wend

End

Index