Giter Site home page Giter Site logo

Comments (6)

bigrig2212 avatar bigrig2212 commented on August 12, 2024 1

Got it working in es6 with straight javascript (versus typescript):
Here's the file: cc.js.zip

and then in my entry file i've got the following imports (some of these aren't needed just for character controller, but here you go anyway):

import { Engine } from '@babylonjs/core/Engines/engine'
import { Texture } from '@babylonjs/core/Materials/Textures/texture'
import { CubeTexture } from '@babylonjs/core/Materials/Textures/cubeTexture'
import { StandardMaterial } from '@babylonjs/core/Materials/standardMaterial'
import { Vector3, Color3 } from '@babylonjs/core/Maths/math'
import { ArcRotateCamera } from '@babylonjs/core/Cameras/arcRotateCamera'
import { HemisphericLight } from '@babylonjs/core/Lights/hemisphericLight'
import { DirectionalLight } from '@babylonjs/core/Lights/directionalLight'
import { CreateSphere } from "@babylonjs/core/Meshes/Builders/sphereBuilder";
import { CreateGround } from "@babylonjs/core/Meshes/Builders/groundBuilder";
import { CreateGroundFromHeightMap } from "@babylonjs/core/Meshes/Builders/groundBuilder";
import { CreateBox} from "@babylonjs/core/Meshes/Builders/boxBuilder"
import { ShadowGenerator } from '@babylonjs/core/Lights/Shadows/shadowGenerator'
import { ShadowGeneratorSceneComponent } from '@babylonjs/core/Lights/Shadows/shadowGeneratorSceneComponent'
import { EnvironmentHelper } from '@babylonjs/core/Helpers/sceneHelpers'

import {CharacterController} from './cc'
import { SceneLoader } from "@babylonjs/core/Loading/sceneLoader"
import { GLTFLoader } from "@babylonjs/loaders/glTF/2.0/glTFLoader"```

from babylonjs-charactercontroller.

ssatguru avatar ssatguru commented on August 12, 2024

I would like to do that but not quite sure how.
Show me some code snippet as to how you would like to use and let me see if I can work something out

from babylonjs-charactercontroller.

allaaaaan avatar allaaaaan commented on August 12, 2024

Thanks for the replay @ssatguru

Basically, you just need to replace your BJS dependencies to ES6 module version
BJS ES6 Module
image

Then replace the import usage within your code
image

from babylonjs-charactercontroller.

ssatguru avatar ssatguru commented on August 12, 2024

What about users who are using the non es6 version of BABYLONJS ? Would I have to maintain a separate version for them?

from babylonjs-charactercontroller.

allaaaaan avatar allaaaaan commented on August 12, 2024

Yes, normally that is how it works. Two seperate repos.

BTW, do you have any existing project using this lib?

from babylonjs-charactercontroller.

ssatguru avatar ssatguru commented on August 12, 2024

Ok. This might take some time. I would suggest that for now just fork and use it. Its just one file. You can probably just add the source itself to your project.
Yes I do have a project which uses this. This was actually part of that project . I moved it out thinking it might be useful to others.
The project - https://github.com/ssatguru/Vishva.ts/tree/modularize

from babylonjs-charactercontroller.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.