Advertisement
PaleoCrafter

Untitled

Jan 6th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.35 KB | None | 0 0
  1. def lookAt(pos: Vector3): Unit = {
  2.   val camPos = Vector3(cam.getPositionVector)
  3.   val diff = camPos - pos
  4.   val yaw =  math.toDegrees(math.atan(diff.x / diff.z)).toFloat
  5.   val pitch = math.toDegrees(math.atan(diff.y / diff.z)).toFloat
  6.  
  7.   cam.rotationYaw = yaw
  8.   cam.prevRotationYaw = yaw
  9.   cam.rotationPitch = pitch
  10.   cam.prevRotationPitch = pitch
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement