Advertisement
dragonbane

Cam Stuff

Mar 20th, 2021 (edited)
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. _forward = normalize(point - position);
  2.  
  3. (cos(pitch)cos(yaw), cos(pitch)sin(yaw), sin(pitch))
  4.  
  5.  
  6. float xPos = Mathf.Sin(transform.eulerAngles.y * Mathf.Deg2Rad) * Mathf.Cos(transform.eulerAngles.x * Mathf.Deg2Rad);
  7. float yPos = Mathf.Sin(-transform.eulerAngles.x * Mathf.Deg2Rad);
  8. float zPos = Mathf.Cos(transform.eulerAngles.x * Mathf.Deg2Rad) * Mathf.Cos(transform.eulerAngles.y * Mathf.Deg2Rad);
  9.  
  10. print(xPos + ", " + yPos + ", " + zPos + ", " + transform.forward);
  11.  
  12. https://forum.unity.com/threads/what-is-the-math-behind-calculating-transform-forward-of-an-object.521318/
  13.  
  14. https://gamedev.stackexchange.com/questions/90208/how-to-calculate-a-direction-vector-for-camera
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement