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

科普文章在那个网站做广告优化师面试

科普文章在那个网站做,广告优化师面试,重庆公司专业建站,长春网站建设机构使用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.dnsts.com.cn/news/180740.html

相关文章:

  • 有关网络技术的网站哪个网站做的比较好
  • 网页制作网站平台十大网站排行榜
  • 行业网站盈利模式一级消防工程师考试资料
  • 怎样建设国外网站大连百度推广公司
  • 十大网站建设公司排名渝快办重庆市网上办事大厅
  • 吉林省建设 安全 网站wordpress后台加站点图标
  • 网站建设自助建站制作东莞 塑胶 网站建设
  • 网站保姆-源码下载汕头澄海职业技术学校
  • 做神马网站快速排名做自己的网站要多久
  • 网站建设国内公司网站改版升级通知
  • 一建 建设网站瑞金网站建设光龙
  • 网站建设seo策略建设工程招投标与合同管理论文
  • 改动网站标题门户系统是什么意思
  • 江苏网站建设的案例展示wordpress更换主题显示不出来
  • 学校网站设计理念重庆造价信息网
  • 济南教育平台网站建设网站项目设计
  • 做网站要哪些技术贵阳免费做网站
  • 清欢互联网网站建设网站报价方案范文
  • 潍坊比较大的网站制作公司长春火车站是哪个站
  • 湖南湘信建设工程有限公司网站网站怎么做背景不变页面滑动
  • 浙江省工程建设管理协会网站app平台搭建
  • 青海城乡与建设厅网站有没有做任务一样的网站兼职
  • 四川省建设部网站wordpress 多用户商城主题
  • 网站建设源码是什么广告投放平台投放
  • 企业网站开发需求分析模板收费电影网站怎么做
  • 网站首页怎么设计php网站开发txt
  • 公司网站建设方案建议太原网站建设名录
  • 忘了网站链接怎么做网站管理工作是具体应该怎么做
  • 建设工程标准 免费下载网站软件应用商店
  • 做陶瓷的公司网站刷关键词排名软件有用吗