当前位置: 首页 > news >正文

科普文章在那个网站做1717做网站

科普文章在那个网站做,1717做网站,提升学历的四种方式,珠海网站建设技术外包使用Python USD API 来实现 Physics 。 以下内容中#xff0c;大部分 Python 代码可以在 Physics Python 演示脚本文件中找到#xff0c;本文仅作为个人学习笔记。 一.设置 USD Stage 和物理场景 Setting up a USD Stage and a Physics Scene USD Stage不知道怎么翻译#…使用Python USD API 来实现 Physics 。 以下内容中大部分 Python 代码可以在 Physics Python 演示脚本文件中找到本文仅作为个人学习笔记。 一.设置 USD Stage 和物理场景 Setting up a USD Stage and a Physics Scene USD Stage不知道怎么翻译就是放置USD文件的地方Isaac Sim软件和官方文档全英文就算翻译了官方文档回去使用软件也全是英文...英语菜狗啃的累死我了... from pxr import Usd, UsdGeom, UsdPhysics, UsdShade, Sdf, Gf, Tf# Set up a USD Stage to define what is the up axis and set up the units, # which is crucial, as some default simulation parameters are derived # from the MetersPerUnit value # 单位0.01m stage omni.usd.get_context().get_stage() UsdGeom.SetStageUpAxis(stage, UsdGeom.Tokens.z) UsdGeom.SetStageMetersPerUnit(stage, 0.01)# Physics scene definition scene UsdPhysics.Scene.Define(stage, /physicsScene)# setup gravity # note that gravity has to respect the selected units, if we are using cm, the gravity has to respect that # 重力方向下重力大小9.81m/s^2 scene.CreateGravityDirectionAttr().Set(Gf.Vec3f(0.0, 0.0, -1.0)) scene.CreateGravityMagnitudeAttr().Set(981.0) 二.创建碰撞体 Creating Colliders  # Cube path cubeActorPath /cubeActor# Cube parameters like size, position, orientation # 这个500测试发现实在太高了第一次做的时候转一圈都没找到Cube自己用设置1050之类的就行 size 25.0 position Gf.Vec3f(0.0, 0.0, 500.0) orientation Gf.Quatf(1.0) color Gf.Vec3f(71.0 / 255.0, 105.0 / 255.0, 1.0)# define the cube geom(几何) cubeGeom UsdGeom.Cube.Define(stage, cubeActorPath) cubeGeom.CreateSizeAttr(size) cubeGeom.AddTranslateOp().Set(position) cubeGeom.AddOrientOp().Set(orientation) cubeGeom.AddScaleOp().Set(Gf.Vec3f(1.0)) cubeGeom.CreateDisplayColorAttr().Set([color])# get the prim cubePrim stage.GetPrimAtPath(cubeActorPath)# setup collision, so that the cube does collider UsdPhysics.CollisionAPI.Apply(cubePrim) 三.不同的碰撞体和渲染表现  Different Collision and Rendering Representations  必须创建两个不同的几何体其中一个用于碰撞另一个用于渲染(这里也可以理解为展示一个作为碰撞箱隐藏一个可以观察)。两个几何体的父 xform 应该设置为刚体使它们能够一起移动。 # Top level actor, contains rigid body rigidCompoundPath /compoundRigid rigidXform UsdGeom.Xform.Define(stage, rigidCompoundPath) rigidPrim stage.GetPrimAtPath(rigidCompoundPath)# Rigid body transform rigidCompoundPos Gf.Vec3f(0.0, 0.0, 10.0) rigidXform.AddTranslateOp().Set(rigidCompoundPos) rigidXform.AddOrientOp().Set(Gf.Quatf(1.0, 0.0, 0.0, 0.0))physicsAPI UsdPhysics.RigidBodyAPI.Apply(rigidPrim)# Collision shape collisionShape rigidCompoundPath /physicsBoxShapesize 25.0 shapePos Gf.Vec3f(0.0) shapeQuat Gf.Quatf(1.0)cubeGeom UsdGeom.Cube.Define(stage, collisionShape) cubePrim stage.GetPrimAtPath(collisionShape) cubeGeom.CreateSizeAttr(size) cubeGeom.AddTranslateOp().Set(shapePos) cubeGeom.AddOrientOp().Set(shapeQuat)# set it as collision UsdPhysics.CollisionAPI.Apply(cubePrim)# hide it from rendering cubeGeom.CreatePurposeAttr(UsdGeom.Tokens.guide)# rendering shape renderSphere rigidCompoundPath /renderingSpheresphereGeom UsdGeom.Sphere.Define(stage, renderSphere) #sphereGeom.CreateSizeAttr(20.0) sphereGeom.AddTranslateOp().Set(shapePos) sphereGeom.AddOrientOp().Set(shapeQuat) 四.物理材料  Physics Materials 每个碰撞器都可以分配不同的物理材料。UsdPhysicsMaterialAPI 可以应用于任何其他材料并且此 API 添加了物理材料属性如静态/动态摩擦。要将材料分配给碰撞器请使用具有“物理”目的的材料绑定。 # define physics material materialPath /material mu 1.0 UsdShade.Material.Define(stage, materialPath) material UsdPhysics.MaterialAPI.Apply(stage.GetPrimAtPath(materialPath)) material.CreateStaticFrictionAttr().Set(mu) material.CreateDynamicFrictionAttr().Set(mu) material.CreateRestitutionAttr().Set(0.0) material.CreateDensityAttr().Set(1000.0)collisionAPI UsdPhysics.CollisionAPI.Get(stage, collisionShape)# add the material to the collider bindingAPI UsdShade.MaterialBindingAPI.Apply(collisionAPI.GetPrim()) materialPrim material.GetPrim() material UsdShade.Material(materialPrim) bindingAPI.Bind(material, UsdShade.Tokens.weakerThanDescendants, physics) 五.使用凸网格进行圆柱和圆锥碰撞 Using Convex Mesh for Cylinder and Cone Collision UsdGeom.Cylinder 和 UsdGeom.Cone prims 的碰撞默认近似为自定义几何体以获得更高的精度。但是您可以通过在碰撞部分下的物理设置中禁用相应的切换来将它们设置为使用凸网格。 注意您还可以使用 Omniverse Create 内置的圆锥和圆柱网格几何体进行凸近似。这允许您细粒度控制是否应使用凸近似或自定义几何体碰撞器模拟单个几何体。 原文 UsdGeom.Cylinder and UsdGeom.Cone prims’ collision is by default approximated as custom geometry for higher precision. However, you can set them to use convex mesh instead by disabling the corresponding toggles in the Physics settings under the collision section. Note: you can also use the Omniverse Create built-in cone and cylinder mesh geometries for convex approximation. This allows you to fine grain control whether individual geometry should be simulated with a convex approximation or custom geometry collider. 我想应该可以对单个物体模块进行精细修改...还没试呢晚上找个时间弄弄看。 六.刚体 Rigid Bodies 刚体在 Physics 架构中表示为应用于 xformable Prim 的 UsdPhysicsRigidBodyAPI 架构。 # Cube path cubeActorPath /cubeActorRigid# Cube parameters like size, position, orientation size 25.0 position Gf.Vec3f(0.0, 0.0, 500.0) orientation Gf.Quatf(1.0) color Gf.Vec3f(71.0 / 255.0, 105.0 / 255.0, 1.0)# initial velocities linVelocity Gf.Vec3f(2.0, 1.0, 2.0) angularVelocity Gf.Vec3f(1.0, 0.0, 0.0)# define the cube geom cubeGeom UsdGeom.Cube.Define(stage, cubeActorPath) cubeGeom.CreateSizeAttr(size) cubeGeom.AddTranslateOp().Set(position) cubeGeom.AddOrientOp().Set(orientation) cubeGeom.AddScaleOp().Set(Gf.Vec3f(1.0)) cubeGeom.CreateDisplayColorAttr().Set([color])# get the prim cubePrim stage.GetPrimAtPath(cubeActorPath)# setup collision, so that the cube does collider UsdPhysics.CollisionAPI.Apply(cubePrim)# setup physics - rigid body rigidBodyAPI UsdPhysics.RigidBodyAPI.Apply(cubePrim)# apply initial velocities rigidBodyAPI.CreateVelocityAttr().Set(linVelocity) rigidBodyAPI.CreateAngularVelocityAttr().Set(angularVelocity) 在仿真过程中如果要更改刚体的线速度则必须更改 UsdPhysicsRigidBodyAPI 的速度属性 rigidBodyAPI.CreateVelocityAttr().Set(newVelocity) 6.1 刚体质量属性 Rigid Body Mass Properties UsdPhysicsMassAPI 定义了刚体的质量属性。UsdPhysicsMassAPI 可以应用于具有 UsdPhysicsRigidBodyAPI 或 USdPhysicsCollisionAPI 的 Prim。它提供了多种定义刚体质量属性的方法 physics:mass质量属性。注意任何子 Prim 在应用 UsdPhysicsMassAPI 时也可以具有质量属性。在这种情况下优先规则是“父级质量属性覆盖子级的质量属性”。这可能有些反直觉因为质量是一个计算得到的量通常不是累积的。例如如果父级的质量为 10而两个子级中的一个质量为 20允许子级的质量覆盖父级的质量将导致另一个子级的质量为 -10。 physics:density密度属性。在刚体物理学的背景下密度间接地通过公式质量 密度 × 对象的体积来设置质量。在同时指定密度和质量的情况下质量具有优先权。与质量不同子级 Prim 的密度将覆盖父级 Prim 的密度。注意collisionAPI 的密度也可以通过 physicsMaterial 关系来设置。材料密度在密度定义中具有最弱的优先级。注意密度遵循单位。因此对于单位为 1 的水密度为 1000对于单位为 0.01水密度为 0.001。 physics:centerOfMassPrim 本地空间中的质心。 physics:diagonalInertia未旋转状态下对角化惯性张量。 physics:principalAxes惯性张量主轴的方向四元数表示在 Prim 的本地空间中。 解析代码会收集每个碰撞形状的质量属性并使用计算出的惯性张量来计算体的最终质量属性。如果未找到任何 massAPI则使用默认密度 1000 来确定最终的质量。 # Cube path cubeActorPath /cubeActorRigidMass# Cube parameters like size, position, orientation size 25.0 position Gf.Vec3f(0.0, 0.0, 500.0) orientation Gf.Quatf(1.0) color Gf.Vec3f(71.0 / 255.0, 105.0 / 255.0, 1.0)# define the cube geom cubeGeom UsdGeom.Cube.Define(stage, cubeActorPath) cubeGeom.CreateSizeAttr(size) cubeGeom.AddTranslateOp().Set(position) cubeGeom.AddOrientOp().Set(orientation) cubeGeom.AddScaleOp().Set(Gf.Vec3f(1.0)) cubeGeom.CreateDisplayColorAttr().Set([color])# get the prim cubePrim stage.GetPrimAtPath(cubeActorPath)# setup collision, so that the cube does collider UsdPhysics.CollisionAPI.Apply(cubePrim)# setup physics - rigid body, so that cube does simulate as a rigid body UsdPhysics.RigidBodyAPI.Apply(cubePrim)# custom center of mass massAPI UsdPhysics.MassAPI.Apply(cubePrim) massAPI.CreateCenterOfMassAttr().Set(Gf.Vec3f(0.0, 0.0, 10.0)) 七.静态体和动态体的区别 Difference Between a Static Body and a Dynamic Body 如果找到具有 UsdPhysicsCollisionAPI 的 Geom Prim则它可以属于静态实体或动态实体。决定的逻辑是这样的 如果层次结构中的 prim 或任何父 Prim 上没有应用 UsdPhysicsRigidBodyAPI则具有 UsdPhysicsCollisionAPI 的几何体将被视为静态实体。 还 如果 physicsrigidBodyEnabled 属性为 true默认值则几何属于动态实体。 否则Geom 属于静态实体。 八.运动体 Kinematic Body 如果需要通过动画或用户定义的目标位置来驱动身体则应将 UsdPhysicsRigidBodyAPI 上的 physicskinematicEnabled 属性设置为 true。 九.CPU 与 GPU 刚体动力学 CPU vs GPU Rigid Body Dynamics 默认情况下在 GPU 上执行刚体仿真。可以在 Physics Debug 窗口中或使用场景属性覆盖管道。 为了使用 CPU 仿真请在 UsdPhysicsScene prim 中添加一个 PhysxSceneAPI 并设置以下属性 physxScenebroadphaseType - MBP physxSceneenableGPUDynamics - 错误 对于 GPU 模拟第一个设置为 GPU第二个设置为 True。
http://www.hkea.cn/news/14538992/

相关文章:

  • 帝国网站整站迁移我想来做外贸网站来推广
  • 网站建设叁金手指花总2网站服务理念
  • 网站域名不合法wordpress批量替换代码
  • 网站建设开发服务费品牌创建的六个步骤
  • 关于加强门户网站建设单页面网站
  • 外贸多语种网站推广成都建设网站首页
  • 网站如何添加二维码家具定制东莞网站建设
  • 在哪找专业做淘宝网站网站开发这个专业前景怎样
  • 专业的网站建设哪家好公众平台微信登录
  • 德州市建设工程质监站网站济南住房和房产信息网
  • 淮北矿业 集团 工程建设有限责任公司网站WordPress画表格
  • wordpress站群管理破解版网页qq音乐在线听
  • 购物网站模板 php中信建设公司好进去吗
  • wordpress自定义简码百度上做优化
  • 如何制作淘客导购网站网站建站服务的公司
  • 内蒙古建设项目环保备案网站网页设计风格分类
  • 下载asp网站网页设计用什么尺寸的画布
  • 公众号的微网站怎么做的什么网站内链建设
  • 住房和城建设网站首页高校网站如何建设论文
  • 大理做网站哪家好建设公司哪家好
  • 网站建设 肥城网页设计尺寸多大
  • 太原网站开发定制成都大邑网站建设
  • 财务公司网站源码宁波网站设计价格
  • 资源付费网站制作怎么做自己的卡盟网站
  • 淘宝购物券网站怎么做做技能培训和那个网站合作好
  • 互联网站备案知名网站建设公司好吗
  • 邢台网站设计哪家专业建设网站的企业专业服务
  • 全企网建站怎么样专业的网站建设费用
  • 营销网站建设文章单页网站seo怎么做
  • 有关商业网站的风格特征温州高端品牌网站建设