Webots学习笔记 3.创建一个Solid node

1.环境相关

新建一个仿真世界

$新建一个世界

一个更好的地板

$添加 TexturedBackground /TexturedBackgroundLight /

修正地板

Note: 设置一个对象属性为静态的方法:把其物理节点(physics node)设置为空

$添加 PROTO (Webots) / objects / floors / Floor (Solid)

光照

世界光取决于光节点,分别是: the DirectionalLight(无穷远) / the PointLight(点光源,比如灯光) / the SpotLight(聚光灯,比如电手筒),每种光都能产生阴影。
最小化光的数量可以提高软件的渲染速度。
note: 可以比较fView / Wireframe Rendering View / Plain Rendering 两种软件自带渲染模式,主要是提高运行速度。

2.创建Solid node

solid节点

对于每个一个刚体都有一个soild节点(或者是其继承子节点)和它对应。

physics
boundingObject
children
geometry
solid
Physics
Geometry1
Shape
Geometry2

主要有三个子节点描述其特征。

新建一个球

$ 添加 solid 节点
$ 选择其 children field,添加一个Shape node。在Shape node下面选择appearance field,添加一个 PBRAppearance node,调整 PBRAppearance node 下面 metalness field 为 0,roughness field 为1。
$为 Shape node 下面的 geometry field 添加一个Sphere node。
$为 Solid node 下面的 boundingObject field 添加一个Sphere node。
$为 Solid node 下面的 physics field 添加一个 Physics node。

Note:
仿真的时候可以用给物体施加一个力 (CTRL + ALT + left-click + drag)
物体跟地板间的接触点可以通过面板显示出来 View / Optional Rendering / Show Contact Points menu item

修改球的外观

$ Shape node 下面的 PBRAppearance node,把metalness field (金属贴图) 设置为0 , roughness(粗糙) field 设置为 1.
$ 添加 ImageTexture node 到 PBRAppearance node 的baseColorMap field
$ 为 ImageTexture’s url field添加一个新项,值为"WEBOTS_HOME/projects/default/worlds/textures/red_brick_wall.jpg

note:这里路径使用相对路径,没有添加环境变量的话直接使用绝对路径。

DEF 使用机制

$在创建球的环节中在Shape node下面添加一个Sphere node之后,选中geometry Sphere节点,在下面的DEF对话框中键入自定义名字BALL_GEOMETRY。
$在为boundingObject field 添加Sphere时候,选择use,使用上一步的BALL_GEOMETRY。

此时上面的图变成了:

physics
boundingObject
children
geometry
solid
Physics
USEDEF
DEFBALL_GEOMETRYSphere
Shape

添加墙

$选中 scene tree 的Floor,添加一个Solid node。
$ 选中Solid node 的children域,添加Shape node。
$ 选中新添加的Shape node,在下方DEF框中填入a
$ 找到Solid node 的boundingObject field,添加a
$ 回到children域中的 Shape node,为appearance node添加PBRAppearance node。为geometry node 添加 box node。
$ 调整geometry Box 的size
$ 添加剩余3道墙

修改墙的颜色

$ Shape node 下面的 PBRAppearance node,把 baseColor field 值设值为蓝色(点击按钮选预设值)
$ 分别把下面两参数设成对应值。 metalness field to 0 ,roughness field to 0.5
$ 此时可以看到4面墙全部变成蓝色。

note:
1.这里boundingObject field 直接用的Shape node而不是Sphere node,这样更方便。
2.第一道墙配置好后,选中该node,再添加新的Solid node而不是直接复制,这样新添加后的Solid node中才能在use找到a。直接复制配置好的节点则找不到a。

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值