我学会了用类型脚本编写babylonjs场景
import {Scene, Engine, FreeCamera, Vector3, HemisphericLight, MeshBuilder, StandardMaterial, Texture, CubeTexture, PBRMaterial, SceneLoader, AbstractMesh, ActionManager, SetValueAction, InterpolateValueAction, IncrementValueAction, Mesh, CannonJSPlugin, PhysicsImpostor, Size, Color3, int} from "@babylonjs/core"
import "@babylonjs/loaders"
import * as CANNON from "cannon"
export class FpController {
scene: Scene
engine: Engine
box!: AbstractMesh
sphere!:AbstractMesh
cylinder!:AbstractMesh
ground!:AbstractMesh
sphereMat!: PBRMaterial
x: int
constructor( private canvas:HTMLCanvasElement){
this.x = Math.floor( Math.random() * 2) +1;
this.engine =new Engine(this.canvas, true)
this.scene = this.CreateScene()
if (this.x === 2){
this.CreateEnvironment()
}
if (this.x === 1){
this.CreateEnvironment2()
}
// this.CreateImposter()
this.CreateController()
// this.Triggered()
this.engine.runRenderLoop(()=>{
this.scene.render()
})
}
到目前为止,我正在尝试将其作为网站启动。我尝试过 github、“npm run build”和“Netlify”,但没有一个起作用。有谁知道该怎么办吗?
到目前为止,我正在尝试将其作为网站启动。我尝试过 github、“npm run build”和“Netlify”,但没有一个起作用。有谁知道该怎么办吗?
你试图一次做太多事情。