亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

ARCore – 模型旋轉

ARCore – 模型旋轉

白衣非少年 2023-09-20 15:20:17
我正在 ARCore Android 中工作,我想在單擊按鈕時旋轉 3D 模型。我已經完成了旋轉,但問題是它不會在當前位置旋轉,即如果模型移動到平面上的其他位置,它會回到模型投影的初始位置,在這里我們可以看到旋轉。我想將我的模型旋轉到平面上的任何位置,并且它保留在那里。這是我的代碼 private void rotateRight(TransformableNode node, AxisClass objAxis, Vector3 pos) {     node.getRotationController().setEnabled(true);     node.getScaleController().setEnabled(true);     node.getTranslationController().setEnabled(false);     Quaternion rightMoveVector = new Quaternion();     rightMoveVector = tNode.getLocalRotation();     Quaternion orientations = new Quaternion();     Quaternion orientation = Quaternion.axisAngle(new Vector3(pos.x, 1.0f, pos.z), rotateAngle);     node.setLocalRotation(Quaternion.axisAngle(new Vector3(0.0f, 1.0f, 0.0f), rotateAngle));     rotateAngle = rotateAngle + 30;     objAxis.setRotateRight(String.valueOf(rotateAngle));     objAxis.setY_axis(String.valueOf(Math.toRadians(rotateAngle)));}
查看完整描述

1 回答

?
慕桂英3389331

TA貢獻2036條經驗 獲得超8個贊

對于模型旋轉,您必須重寫 sceneform android 中的 onupdate 方法。

執行旋轉后,您必須設置模型位置,使其保持在原來的位置。

Quaternion?q1?=?tNode.getLocalRotation();
????????Quaternion?q2?=?Quaternion.axisAngle(new?Vector3(0f,?1f,?0f),?-2f);
????????tNode.setLocalRotation(Quaternion.multiply(q1,?q2));
????????tNode.setLocalPosition(localPosition);


查看完整回答
反對 回復 2023-09-20
  • 1 回答
  • 0 關注
  • 97 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號