Guest User

Untitled

a guest
Nov 13th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. node.position = SCNVector3(from.x + (to.x - from.x) * 0.5,
  2. from.y + height * 0.5,
  3. from.z + (to.z - from.z) * 0.5)
  4.  
  5. // orientation of the wall is fairly simple. we only need to orient it around the y axis,
  6. // and the angle is calculated with 2d math.. now this calculation does not factor in the position of the
  7. // camera, and so if you move the cursor right relative to the starting position the
  8. // wall will be oriented away from the camera (in this app the wall material is set as double sided so you will not notice)
  9. // - obviously if you want to render something on the walls, this issue will need to be resolved.
  10.  
  11. node.eulerAngles = SCNVector3(0,
  12. -atan2(to.x - node.position.x, from.z - node.position.z) - Float.pi * 0.5,
  13. 0)
Add Comment
Please, Sign In to add comment