Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def lookAt(pos: Vector3): Unit = {
- val camPos = Vector3(cam.getPositionVector)
- val diff = camPos - pos
- val yaw = math.toDegrees(math.atan(diff.x / diff.z)).toFloat
- val pitch = math.toDegrees(math.atan(diff.y / diff.z)).toFloat
- cam.rotationYaw = yaw
- cam.prevRotationYaw = yaw
- cam.rotationPitch = pitch
- cam.prevRotationPitch = pitch
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement