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
添加物品隐藏显示按钮栏