Mars3d实现汽车尾气粒子效果从汽车屁股开始发射效果

本身的汽车尾气粒子效果:在汽车模型的中间发射的↓↓↓↓↓↓↓↓↓↓↓

Mars3d实例中是使用transY偏移值实现汽车尾气粒子效果从汽车屁股开始发射效果:

复制代码
// 动态运行车辆的尾气粒子效果
function addDemoGraphic4(graphicLayer) {
  const fixedRoute = new mars3d.graphic.FixedRoute({
    speed: 120,
    positions: [
      [117.226585, 31.818437, 32.41],
      [117.226838, 31.811681, 28.23]
    ],
    clockLoop: true, // 是否循环播放
    model: {
      url: "//data.mars3d.cn/gltf/mars/qiche.gltf",
      scale: 0.2
    }
  })
  graphicLayer.addGraphic(fixedRoute)

  fixedRoute.start() // 启动漫游

  const particleSystem = new mars3d.graphic.ParticleSystem({
    position: fixedRoute.property,
    style: {
      image: "./img/particle/smoke.png",
      particleSize: 12, // 粒子大小(单位:像素)
      emissionRate: 20.0, // 发射速率 (单位:次/秒)
      pitch: 40, // 俯仰角
      // gravity: -1, // 重力因子,会修改速度矢量以改变方向或速度(基于物理的效果)
      transY: 8.0, // 偏移值Y,尾气在车辆后面一些
      maxHeight: 1000, // 超出该高度后不显示粒子效果

      startColor: Cesium.Color.GREY.withAlpha(0.7), // 开始颜色
      endColor: Cesium.Color.WHITE.withAlpha(0.0), // 结束颜色
      startScale: 1.0, //  开始比例(单位:相对于imageSize大小的倍数)
      endScale: 5.0, // 结束比例(单位:相对于imageSize大小的倍数)
      minimumSpeed: 1.0, // 最小速度(米/秒)
      maximumSpeed: 4.0 // 最大速度(米/秒)
    },
    attr: { remark: "车辆尾气" }
  })
  graphicLayer.addGraphic(particleSystem)
}

示例链接:功能示例(Vue版) | Mars3D三维可视化平台 | 火星科技

相关效果:

粒子本身的参数emitterModelMatrix也可以实现从车屁股开始发射效果:

复制代码
// 动态运行车辆的尾气粒子效果
function addDemoGraphic4(graphicLayer) {
  const fixedRoute = new mars3d.graphic.FixedRoute({
    speed: 120,
    positions: [
      [117.226585, 31.818437, 32.41],
      [117.226838, 31.811681, 28.23]
    ],
    clockLoop: true, // 是否循环播放
    model: {
      url: "//data.mars3d.cn/gltf/mars/qiche.gltf",
      scale: 0.2
    },
      attr: { remark: "车辆尾气emitterModelMatrix实现" }
  })
  graphicLayer.addGraphic(fixedRoute)

  fixedRoute.start() // 启动漫游

  const particleSystem = new mars3d.graphic.ParticleSystem({
    position: fixedRoute.property,
    emitterModelMatrix: Cesium.Matrix4.fromTranslation( new Cesium.Cartesian3(0, 15, 0)),
    style: {
      image: "./img/particle/smoke.png",
      particleSize: 12, // 粒子大小(单位:像素)
      emissionRate: 20.0, // 发射速率 (单位:次/秒)
      pitch: 40, 
      maxHeight: 1000, // 超出该高度后不显示粒子效果
      startColor: Cesium.Color.GREY.withAlpha(0.7), // 开始颜色
      endColor: Cesium.Color.WHITE.withAlpha(0.0), // 结束颜色
      startScale: 1.0, //  开始比例(单位:相对于imageSize大小的倍数)
      endScale: 5.0, // 结束比例(单位:相对于imageSize大小的倍数)
      minimumSpeed: 1.0, // 最小速度(米/秒)
      maximumSpeed: 4.0 // 最大速度(米/秒)
    },
    attr: { remark: "车辆尾气" }
  })
  graphicLayer.addGraphic(particleSystem)
}
相关推荐
默默学前端3 分钟前
html列表标签及css列表属性
前端·css·html5
天天扭码9 小时前
如何实现流式输出?一篇文章手把手教你!
前端·aigc·ai编程
前端 贾公子9 小时前
vue移动端适配方案 === postcss-px-to-viewport
前端·javascript·html
GISer_Jing10 小时前
AI营销增长:4大核心能力+前端落地指南
前端·javascript·人工智能
明远湖之鱼11 小时前
一种基于 Service Worker 的渐进式渲染方案的基本原理
前端
前端小端长11 小时前
Vue 中 keep-alive 组件的原理与实践详解
前端·vue.js·spring
FeelTouch Labs12 小时前
Nginx核心架构设计
运维·前端·nginx
雪球工程师团队12 小时前
别再“苦力”写后台,Spec Coding “跑” 起来
前端·ai编程
m0_4711996312 小时前
【场景】前端怎么解决离线收银、数据同步异常等场景问题
前端·javascript