小编New*_*dio的帖子

让孩子不受父母轮换Unity的影响

我的角色里面有2个游戏对象说right_obj和left_obj,我希望他们忽略父旋转,就像玩家改变它的方向(左,右),这两个游戏对象保持他们的位置和旋转,到目前为止我使用2种方法但是失败.这是我的代码,我在我的两个游戏对象上使用这个脚本,但他们忽略了这一行

// first one approch
Quaternion rotation;
void Awake()
{
    rotation = transform.rotation;
}

void LateUpdate () 
{
    transform.rotation = rotation;
}

// 2nd approch
void LateUpdate () 
{
    transform.rotation = Quaternion.identity;;
}
Run Code Online (Sandbox Code Playgroud)

unity-game-engine unityscript

1
推荐指数
3
解决办法
5523
查看次数

标签 统计

unity-game-engine ×1

unityscript ×1