0

I had learned to code babylonjs scenes in type script

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()
        })

        
    }

and as of now I am trying to launch it as a website. I have tried github, "npm run build" and "Netlify", none of them have worked. Does anyone know what to do?

As of now I am trying to launch it as a website. I have tried github, "npm run build" and "Netlify", none of them have worked. Does anyone know what to do?

1 Answer 1

0

You're trying to do too much at once.

  1. First figure out how to deploy a basic "Hello World" HTML web site.
  2. Then figure out how to add JavaScript.
  3. Then figure out how to add TypeScript.
  4. Then and only then start figuring out how to incorporate BabylonJS.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.