Unity 安卓AR日誌
https://blog.csdn.net/sdfdzx/article/details/79594461
用Unity開發AR,打包成Android工程,然後再整合到主Android工程裡
.max轉fbx
建立場景
http://gad.qq.com/article/detail/34681
儲存場景:E:\Users\LENOVO\Unity\New Unity Project\Assets
Unity匯出安卓工程
https://blog.csdn.net/Gavin_today/article/details/49497479
https://wenku.baidu.com/view/15a22363f524ccbff021847a.html
https://blog.csdn.net/qq393830887/article/details/70470460
File / Build Setting,將平臺設定為Android
報錯:Please set the Package Name in the Player Settings.The value must follow the convention ’’ and can contain alphanumeric character and underscore. Each segment must not start with a numeric character or underscore.:
開啟File=>build settings => player settings=>在Inspector找到Bundle Identifier 選項,原來是:com.YourCompanyName.YourProductName
後兩項改個名字就行了
EasyAR顯示
http://forum.easyar.cn/portal.php?mod=view&aid=2
把Unity3D巢狀在ANDROID的檢視
https://blog.csdn.net/a396901990/article/details/38052223
https://blog.csdn.net/qinyuanpei/article/details/39380717
https://blog.csdn.net/qq_22780533/article/details/51908906
https://blog.csdn.net/u014230923/article/details/51363556
UI
https://blog.csdn.net/u014230923/article/details/51371767
Unity移動
https://jingyan.baidu.com/article/3c343ff7c117bc0d377963b0.html
手指拖動
https://blog.csdn.net/q764424567/article/details/80665453
指令碼
https://blog.csdn.net/qq_37936677/article/details/77916052
使用C#指令碼控制遊戲物件https://blog.csdn.net/zzlyw/article/details/54175881
腳本里定義一個MoveSpeed變數作為速度調節變數,通過input來監聽按鍵w、s,a、d通過transform.Translate設定更新物體位置,Vector3.forward是前進、back後退、left是左移、right是右移。
if(Input.GetKey(KeyCode.W)){
this.transform.Translate(Vector3.forward*Time.deltaTime*MoveSpeed);
}
繫結指令碼的方式很簡單,直接用滑鼠把指令碼拖動到Hierarchy檢視或者Scene檢視中對應的物體上即可。也可以先選中物體,然後把指令碼拖動到該物體Inspector檢視(右方)的空白處。
using System.Collections; |
unity3D中,給物體新增剛體後,為什麼不是掉在地面上,而是穿過地形一直往下落
新增剛體後,你還必須給該物體新增一個碰撞。
並且該碰撞不能是meshCollider。
如果非要是MeshCollider,那你還必須給Convex打上勾
也就是你的物體麼有了collider屬性,比如Box Collider、Sphere Collider等
https://blog.csdn.net/xu20082100226/article/details/49883781
建立地面:
https://blog.csdn.net/zomeelee/article/details/47035133
在左欄CREAT
叫Transform的Component, 它有三個屬性Position、Rotation、Scale,分別表示物件的位置、旋轉角度、縮放比例。我們將Scale中的X、Z值修改為2,這意味著我們將Ground沿X、Z方向均拉伸到了原來的兩倍。
Failed to create Convex Mesh from source mesh "default". Source mesh is likely have too many smooth surface regions. Please reduce the surface smoothness of the source mesh. Alternatively turn on Inflate Mesh and increase the Skin Width sufficiently for this mesh.
刪除凸面過多的物體
This action will break the prefab instance.Are you sure you wish to continue
手指拖動
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Drag : MonoBehaviour { //偏移值 Vector3 m_Offset; //當前物體對應的螢幕座標 Vector3 m_TargetScreenVec;
private IEnumerator OnMouseDown() { //當前物體對應的螢幕座標 m_TargetScreenVec = Camera.main.WorldToScreenPoint(transform.position); //偏移值=物體的世界座標,減去轉化之後的滑鼠世界座標(z軸的值為物體螢幕座標的z值) m_Offset = transform.position - Camera.main.ScreenToWorldPoint(new Vector3 (Input.mousePosition.x, Input.mousePosition.y, m_TargetScreenVec.z)); //當滑鼠左鍵點選 while (Input.GetMouseButton(0)) { //當前座標等於轉化滑鼠為世界座標(z軸的值為物體螢幕座標的z值)+ 偏移量 transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, m_TargetScreenVec.z)) + m_Offset; //等待固定更新 yield return new WaitForFixedUpdate(); } } }
|
顯示渲染
https://www.jianshu.com/p/89d88b364d7d
只有能網格化的模型,繫結拖拽事件才有效
剛體元件的具體引數。
1.mass 質量,以千克計算。
2.drag 空氣阻力,當物體受力運動時空氣的阻力,以牛頓計算。
3.angular drag 空氣角阻力,當物體受扭矩力選擇時空氣的阻力,以牛頓計算。
4.use gravity 使用重力,當開啟此項,物體會受到重力作用。
5.is kinematic 是否開啟動力學,開啟此項,物體不受力的作用。
6.constrants:約束。用於控制剛體運動的約束。
待修改:
找模型,儲存列表,首頁
新增按鈕點選事件
https://jingyan.baidu.com/article/af9f5a2d7fdb6443150a4571.html
https://www.cnblogs.com/jiangyuzhen/p/7136881.html
Button元件下有on Click()列表
先把指令碼新增到按鈕,再設定on Click方法
判斷unity物體是否顯示狀態
https://blog.csdn.net/qq_38655924/article/details/80898941
控制組件啟用
https://blog.csdn.net/Testiness_Wind/article/details/78952775
showGround.GetComponent<MeshRenderer>().enabled
是變數,可直接獲取當前值
日誌
修改攝像機背景顏色,大小
床、櫃子增加碰撞元件、剛體元件
控制地板影象渲染但保持物件啟用(透明)
改進自定義碰撞器,加快渲染速度
控制mass重量,大物件100,小物件20
新增物品隱藏顯示按鈕欄