TurnToEntity

Blitz3D Forums/Blitz3D Programming/TurnToEntity

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Does this work better. You can use this to point to anything including a specific point in the world. It will turn at a maximum of 'speed' degrees.

global pivot = createpivot()

Function Point_Entity( entity,speed# , x# , y# , z# )
  positionentity pivot,x,y,z
  pitch# = qlimit( -deltapitch(entity,pivot), -speed,speed)
  yaw# = qlimit ( -deltayaw (entity,pivot), -speed,speed)
  turnentity entity , pitch , yaw ,0
end function

function qlimit#(q#,lo#,hi#)
  if q > hi q = hi
  if q < lo q = lo
return q