three实现三维点光球物理碰撞光影动画效果代码

代码语言:html

所属分类:三维

代码描述:three实现三维点光球物理碰撞光影动画效果代码,单击鼠标左键发射物体射击小球。

代码标签: three 三维 点光 物理 碰撞 光影 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  


  
  
  
<style>
* {
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  margin: 0;
  padding: 0;
}
body {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
}
canvas {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  margin: 0;
  padding: 0;
}
</style>


  
  
</head>

<body >

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/es-module-shims.1.6.2.js"></script>
<script type="importmap">
  {
    "imports": {      
      "three": "//repo.bfw.wiki/bfwrepo/js/module/three/build/151/three.module.js",
      "three/addons/": "//repo.bfw.wiki/bfwrepo/js/module/three/examples/151/jsm/"
    }
  }
</script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/ammo.wasm.min.js"></script>
      <script  type="module">
async function e() {
  function e(e) {
    let t = null;
    m.setValue(0, 0, 0);
    let n = e.attributes.position.array;
    t = new Ammo.btConvexHullShape();
    for (let e = 0, o = n.length; e < o; e += 3) {
      m.setValue(n[e], n[e + 1], n[e + 2]);
      const a = e >= o - 3;
      t.addPoint(m, a);
    }
    return t && t.setMargin(0), t;
  }
  function n(e, t, n, a = null) {
    u = e.position,
    w = e.quaternion,
    d.setIdentity(),
    m.setValue(u.x, u.y, u.z),
    d.setOrigin(m),
    d.setRotation(new o.btQuaternion(w.x, w.y, w.z, w.w));
    const i = e.scale;
    m.setValue(i.x, i.y, i.z), n.setLocalScaling(m), m.setValue(0, 0, 0);
    const r = new o.btDefaultMotionState(d),
    s = m;
    .........完整代码请登录后点击上方下载按钮下载查看

网友评论0