Author Topic: Camera.setPosition  (Read 2181 times)

Offline AceGIS

  • byte
  • *
  • Posts: 32
    • View Profile
Camera.setPosition
« on: September 18, 2012, 07:21:51 am »
Hi,

How can I get the difference in z between the camera position and the terrain beneath the camera at its current position?

I want my camera position to always be at 2 units above the terrain.

Thanks in advance..

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Camera.setPosition
« Reply #1 on: September 18, 2012, 10:40:25 am »
It depends...you can use the methods for collision detection or calcMinDistance and adjust the height according to the result.

Edit: Depending on the complexity of the terrain, you might want to calculate an OcTree and enable use for collision detection (and disable use for rendering) on it.
« Last Edit: September 18, 2012, 11:10:39 am by EgonOlsen »