如何防止在高度图地形上过于陡峭的斜坡或上山?
我有一个可以在地形上移动的 3D 相机,它现在可以在任何地方移动,甚至在大斜坡和太陡的山丘上,我该怎么办?
如果你试图朝一个方向移动,你应该预测你最终会到达哪里,然后弄清楚是否slope http://cs.selu.edu/~rbyrd/math/slope/当前点和未来点之间的距离太陡:
if(forward key pressed) {
get location I'll end up at
get the Z of that location
calculate slope using rise/run formula
if(slope is too steep) {
don't move
}
else { move to the future location }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)