three.js
yy_1028
这个作者很懒,什么都没留下…
展开
-
three.js教程学习初始化配置
记录一下学习three.js历程,我用的全是class,这里配置一下基础的class文件,由于目前也在学习ts就用了ts了文件目录大概如下:common中写基础的配置,objects中写具体实例, scene中写具体逻辑创建调用Base.tsimport { Scene } from "three"export default class Base { instance:any constructor(){} setPosition (x:number,y.原创 2022-01-20 11:16:45 · 1204 阅读 · 0 评论 -
three.js 教程BufferGeometry讲解
首先先用BufferGeometry创建一条无限延长的线段,初始化线段点addRunline(){ // geometry var geometry = new THREE.BufferGeometry(); // attributes // var positions = new Float32Array( this.MAX_POINTS * 3 ); // 3 vertices per point geometry.setAttribute( 'positi原创 2022-01-20 16:46:37 · 3215 阅读 · 0 评论 -
three.js教程创建仓库场景示例一
首先创建一个空间场景,Template等配置文件可参考three.js教程学习初始化配置director.jsimport Template from "../common/Template"import * as THREE from 'three'import House from "../objects/House"export default class Director extends Template{ constructor (ele) { super(..原创 2022-01-21 15:25:10 · 1568 阅读 · 0 评论 -
three.js教程创建消防场景示例二
先看下最终效果吧开始 创建多个仓库自定义长宽高可参考上一节three.js教程创建仓库场景示例一 addHouse(){ const house1 = new House(150,80,20,this.scene) house1.setPosition(-50, 1, 100) house1.addToScene(this.scene) this.meshList.push(...house1.instance.children) ...原创 2022-01-24 09:15:30 · 1088 阅读 · 0 评论 -
Three.js中使用cannon.js实现物理世界
如上图简单生成box,实现自由落体// 安装cannonnpm i cannondirector.js内容,注:添加地面ground:mass为0;添加box:mass为1import Template from "../common/Template"import * as THREE from 'three'import * as CANNON from 'cannon'export default class Director extends Template{ c..原创 2022-02-16 14:12:54 · 1165 阅读 · 1 评论