PhysX

 1、施加力:

         if(GUILayout.Button("普通力‹",GUILayout.Height()))
{
//施加一个力,X轴方向力度为1000,Y轴方向力度为1000
addFrceObj.rigidbody.AddForce (, , );
} if(GUILayout.Button("位置力",GUILayout.Height()))
{
//施加一个位置力,物体将会朝向这个位置发力移动,力的模式为冲击力。
Vector3 force = cubeObj.transform.position - addPosObj.transform.position;
addPosObj.rigidbody.AddForceAtPosition(force,addPosObj.transform.position,ForceMode.Impulse);
}

 2、刚体的碰撞回调:

 3、What is Kinematic Rigidbodies?

  A Kinematic Rigidbody is a Rigidbody that has the isKinematic option enabled. Kinematic Rigidbodies are not affected by forces, gravity or collisions. They are driven explicitly by setting the position and rotation of the Transform or animating them, yet they can interact with other non-Kinematic Rigidbodies.

  Kinematic Rigidbodies correctly wake up other Rigidbodies when they collide with them, and they apply friction to Rigidbodies placed on top of them.

 4、What is Static Collider?

  A Static Collider is a GameObject that has a Collider but not a Rigidbody. Static Colliders are used for level geometry which always stays at the same place and never moves around. You can add a Mesh Collider to your already existing graphical meshes (even better use the Import Settings Generate Colliders check box), or you can use one of the other Collider types.

 5、The Physics Material is used to adjust friction and bouncing effects of colliding objects.

  

 6、Character Controller

  The Character Controller is mainly used for third-person or first-person player control that does not make use of Rigidbody physics.

  Character Controller组件用于帮助控制没有RigidBody的组件。

 7、Character Controller和RigidBody互斥,同一GameObject只能应用其一。

 8、SmoothFollow.js是内置Camera脚本组件,可以让某个Camera紧跟某个对象,实现第三人称Camera。

  

 9、使用Ray检测碰撞

         //??????0??????
Ray ray = new Ray(Vector3.zero, transform.position);
//?????????
RaycastHit hit;
Physics.Raycast(ray, out hit, );
//?????????????????????????
Debug.DrawLine(ray.origin, hit.point);

10、关节必须依赖于刚体组件。

 11、Triger与Collision分布图:

 12、动态添加关节组件:

         if(GUILayout.Button("添加链条关节"))
{ ResetJoint();
jointComponent = gameObject.AddComponent("HingeJoint");
HingeJoint hjoint = (HingeJoint)jointComponent;
connectedObj.rigidbody.useGravity = true;
hjoint.connectedBody = connectedObj.rigidbody;
} if(GUILayout.Button("添加固定关节"))
{
ResetJoint();
jointComponent =gameObject.AddComponent("FixedJoint");
FixedJoint fjoint = (FixedJoint)jointComponent;
connectedObj.rigidbody.useGravity = true;
fjoint.connectedBody = connectedObj.rigidbody;
}

PhysX的更多相关文章

  1. 关于缺少nvToolsExt64_1.lib时的PhysX的处理

    我本人之所以缺少这个文件是因为我的PhysX如果你的PhysX是从UE4源代码中提取的,那么可能会出现如下错误,提示找不到nvToolsExt64_1.lib(本机是64bit的操作系统) 那就执行u ...

  2. 物理引擎-Physx的源代码去哪里找

    前几天无意中看到了Physx开源了,就连自己的领导也高兴了一下,让本道士去下载源代码琢磨一下,顺便做几个例子跑起来.结果没成想这个nvidia的github上的源代码被移除了,而且csdn,pudn上 ...

  3. Physx入门

    [疑问] 1.Physx中的场景有大小的概念么?如果有大小,那么场景中的刚体超出场景边界之后, 如何定义之后的行为. 2.如何给一个刚体增加动量?目前的接口只看到设置速度或者增加作用力.

  4. Mesh.Bake Scaled Mesh PhysX CollisionData的性能问题

    最近在做项目优化时,遇到Mesh.Bake Scaled Mesh PhysX CollisionData这个问题,随手记录一下. profiler中显示的cpu波峰瓶颈中,Mesh.Bake Sca ...

  5. PhysX Clothing for UE4

    转自:http://www.52vr.com/article-737-1.html Hello! 之前看到论坛里有人发了个关于UE4布料的小知识,于是跟帖说抽空写个布料的工作流程供大家参考,那么,今天 ...

  6. [原][译][physX]phsyX3.3.4官方文档物理引擎基本概念和例子介绍

    世界和物体: 物理世界包括集合的场景,每个包含的物体称为演员(Actors) 每个场景(Scene)都定义了自己的参考框架包含了所有的时间和空间 在不同的场景,演员不互相影响 演员通常有三种类型:刚体 ...

  7. 我所遭遇过的游戏中间件--PhysX

    我所遭遇过的游戏中间件--PhysX PhysX现在是Nvidia的物理中间件.其特点是简练且功能强大.当我最初拿到PHYSX的SDK时,就发现这个物理中间件比Havok要小很多,但该有的功能都有,甚 ...

  8. PhysX SDK src

    PhysX SDK src Physx3.3 source code http://download.csdn.net/download/qq122252656/9427387 Nvidia CUDA ...

  9. PhysX SDK

    PhysX SDK https://developer.nvidia.com/physx-sdk NVIDIA PhysX SDK Downloads http://www.nvidia.cn/obj ...

随机推荐

  1. hql得到一个实体的数量

    Session session=this.getSession;string hql="select count(tb) from table tb";Query query=se ...

  2. UI开发中的Unit test新工具:网页抓屏比较

    在UI开发中,判断是否正常往往需要看到UI长的模样,所以一般的Unit test无法胜任. 现在有一款通过抓屏而后相素比较的方法,或许对于UI自动化测试能够起到比较好的改进效果. 具体请参见:http ...

  3. [ionic开源项目教程] - 第5讲 如何在项目中使用全局配置

    第5讲 如何在项目中使用全局配置? Q:ionic开发,说纯粹一点,用的就是html+css+js,那么无疑跟web开发的方式是类似的.在这里给大家分享一个小技巧,如何在项目中使用全局配置? A:我的 ...

  4. res里面的drawable(ldpi、mdpi、hdpi、xhdpi、xxhdpi)

    (1)drawable-hdpi里面存放高分辨率的图片,如WVGA (480x800),FWVGA (480x854) (2)drawable-mdpi里面存放中等分辨率的图片,如HVGA (320x ...

  5. 51nod1394 差和问题

    我只会用线段树写...不喜欢树状数组..其实跑的也不算慢?然后各种*的时候忘了longlong一直WA...药丸! 而且我不怎么会用map离散化...那么就sort+unique #include&l ...

  6. 漫游Kafka设计篇之Producer和Consumer

    Kafka Producer 消息发送 producer直接将数据发送到broker的leader(主节点),不需要在多个节点进行分发.为了帮助producer做到这点,所有的Kafka节点都可以及时 ...

  7. OK335xS Linux kernel check clock 24M hacking

    /****************************************************************************** * OK335xS Linux kern ...

  8. 学习opengl(起步)

    库可以在这里下载 第一个程序: #ifndef GLUT_DISABLE_ATEXIT_HACK #define GLUT_DISABLE_ATEXIT_HACK #endif #include &l ...

  9. 极大似然估计&最大后验概率估计

    https://guangchun.wordpress.com/2011/10/13/ml-bayes-map/ http://www.mi.fu-berlin.de/wiki/pub/ABI/Gen ...

  10. 添加navbar以及上面的左右按钮代码

    UINavigationBar *navBar = [[UINavigationBaralloc] initWithFrame:CGRectMake(0, 0, 824, 44)]; navBar.b ...