如何在Unity3D的Google Cardboard中獲取中心點的位置?當玩家按下按鈕時,我想在這個中心點射擊炮彈,但是我需要找到代表這個點的矢量的方向。如何在Unity3D的Google Cardboard中獲取中心點的位置?
0
A
回答
1
0
答案是使用Camera.main.transform.forward
// create the bullet object from the bullet prefab
var bullet = (GameObject)Instantiate(bulletPrefab, Camera.main.transform.position - Camera.main.transform.forward, Quaternion.identity);
// make the bullet move away in front of the player
bullet.GetComponent<Rigidbody>().velocity = Camera.main.transform.forward * 4;
相關問題
- 1. 如何在Unity3D Google Cardboard中限制頭部旋轉?
- 2. 如何獲得Google Map的中心點?
- 3. 如何在Android上的地圖v2上獲取中心位置?
- 4. 在standford核心中獲取位置nlp
- 5. 點擊鼠標時獲取方形的中心位置? Java的
- 6. 如何在Google Maps API v3中設置點陣列的中心
- 7. 如何在Google Closure中獲取當前的鼠標位置?
- 8. 如何在Google Maps API中獲取用戶的位置?
- 9. 如何從核心位置獲取gps點的距離?
- 10. 如何在中心位置
- 11. 獲取模型的中心點(位置,比例和旋轉)
- 12. 如何在Listview的OnClickListener中獲取點擊項目的位置?
- 13. 在Google搜索中設置中心點
- 14. 如何設置Google地圖的中心位置
- 15. 如何獲取wifi熱點的位置?
- 16. 如何獲取在ListView中點擊切換按鈕的位置?
- 17. 如何在JTextField中獲取插入點的像素位置?
- 18. 如何在three.js中獲取頂點的絕對位置?
- 19. Aframe - 使用Google Cardboard設置?
- 20. Raphael.js如何獲取相對於中心的紙張和刻度的中心點位置?
- 21. 如何在flex中獲得hslider的水平中心位置?
- 22. 如何使用google map api獲取iOS中的當前位置?
- 23. 如何在Google Maps Android API v2中獲取當前位置?
- 24. 如何在google map v2中獲取當前位置信息?
- 25. 如何在android google maps api V2中獲取當前位置?
- 26. Mono在TreeView中獲取節點位置
- 27. 如何在Revit中獲取Face或PlanarFace元素的中心點
- 28. 在Google地圖中獲取(x,y)中的標記位置
- 29. 如何在Google Maps for Android中的當前Zoomlevel中獲取地理位置
- 30. 如何使用TabLayout在ViewPager中的Google Maps Fragment中獲取當前位置
謝謝你,我很欣賞你的答案。我知道起點,但我不知道如何找到我想拍攝的方向。中心點。 –