尝试部署用打字稿编码的 BabylonJs 网站

问题描述 投票:0回答:1

我学会了用类型脚本编写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”,但没有一个起作用。有谁知道该怎么办吗?

github netlify babylonjs
1个回答
0
投票

你试图一次做太多事情。

  1. 首先弄清楚如何部署一个基本的“Hello World”HTML 网站。
  2. 然后弄清楚如何添加 JavaScript。
  3. 然后弄清楚如何添加 TypeScript。
  4. 然后,只有到那时,才开始弄清楚如何合并 BabylonJS。
© www.soinside.com 2019 - 2024. All rights reserved.