jPCT-AE - a 3d engine for Android => Support => Topic started by: AceGIS on September 18, 2012, 07:21:51 am

Title: Camera.setPosition
Post by: AceGIS on September 18, 2012, 07:21:51 am

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..
Title: Re: Camera.setPosition
Post by: EgonOlsen 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.