【发布时间】:2014-12-02 15:09:34
【问题描述】:
我目前有一个用于建造的物品放置系统。它通过实例化对象的“幽灵”来显示它可以放置的位置,幽灵(半透明)对象连接到相机并在玩家点击时在其位置实例化对象。
我得到了保持幽灵对象的位置,如下所示:
var pos = transform.position + transform.forward * placeDistance; // A position 'someDistance' in front of the player
pos.y = Terrain.activeTerrain.SampleHeight(pos); // Get the position at the surface of the terrain to place the object
firePlaceable.transform.position = pos + Vector3.up * 0.001f; // 'halfHeight' is used in case the pivot is not on the base
现在.. 我需要对象根据地形旋转,以便放置火场或多或少正确旋转。有任何想法吗?最好的计划是什么?
【问题讨论】:
标签: c# unity3d rotation building