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. Remember that ordinal parameters are 1-based!

    问题发生的原因是:hql语句里不需要参数,却添加了一个参数,删掉添加参数的语句就可以了!

  2. POJ 2774 (后缀数组 最长公共字串) Long Long Message

    用一个特殊字符将两个字符串连接起来,然后找最大的height,而且要求这两个相邻的后缀的第一个字符不能在同一个字符串中. #include <cstdio> #include <cs ...

  3. iOS 开发 中级:UIToolbar,UINavigationBar,UITabBar,UIBarButtonItem,UITabBarItem自定义方法总结

    原文:  http://blog.csdn.net/songrotek/article/details/8692866?utm_source=tuicool 对于UIToolbar,UINavigat ...

  4. VBScript - CUD registry key and value

    http://msdn.microsoft.com/en-us/library/aa384906(v=vs.85).aspx HKEY_LOCAL_MACHINE = &H80000002 s ...

  5. c可变参数函数

    C函数要在程序中用到以下这些宏: <pre lang="c" escaped="true">void va_start( va_list arg_p ...

  6. Linux/Unix shell 自动发送AWR report

    观察Oracle数据库性能,Oracle自带的awr 功能为我们提供了一个近乎完美的解决方案,通过awr特性我们可以随时从数据库提取awr报告.不过awrrpt.sql脚本执行时需要我们提供一些交互信 ...

  7. CSS打造三级下拉菜单

    <html><head><meta http-equiv="Content-Type" content="text/html; charse ...

  8. Symfony2学习笔记之表单

    对于一个Web开发者来说,处理HTML表单是一个最为普通又具挑战的任务.Symfony2集成了一个Form组件,让处理表单变的容易起来.在这一节里,我们将从基础开始创建一个复杂的表单,学习表单类库中最 ...

  9. js事件处理相关-实现一个div的拖拽

    最终代码: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" c ...

  10. hdu 1115(计算多边形重心)

    题意:已知一多边形没有边相交,质量分布均匀.顺序给出多边形的顶点坐标,求其重心. 分析: 求多边形重心的题目大致有这么几种: 1,质量集中在顶点上.n个顶点坐标为(xi,yi),质量为mi,则重心 X ...