federicocasares / stratecam

Open Source RTS Camera Script for Unity
http://www.windsoftrade.net/stratecam/
MIT License
74 stars 19 forks source link

Prevent camera from intersect mesh #4

Open dev-bre opened 4 years ago

dev-bre commented 4 years ago

Very useful project. I see you call sampleHeight against the terrain object to calculate the delta to move the camera away from the terrain.

In my case the terrain itself is a procedurally gen mesh and not a Unity Terrain.

Do you have any suggestion about how to achieve the same result?

federicocasares commented 4 years ago

Hey there. I suppose you could easily implement an equivalent to sampleHeight in your own terrain and change any calls in Stratecam. If you are building your terrain from a heightmap this shouldn't be too complicated.