Migrate to Babylon Toolkit: V5.0.0

Hello,

I had a project made with Babylon Toolkit: v4.0.3. It consists of a room and some objects in it, player can move around using the WASD key on desktop browser with VR enabled on mobile, basically the default setting.
A few days ago, I found that there is a new version released so I decided to try it out.
However the new version seems to be quite different from v4 and I couldn’t make the project to work.

Firstly I was stuck at the camera setting, I would like to make the followings to work:

  1. Use WASD-key to move around on desktop, the camera was locked at the starting position and cannot move around now
    (Edit: Turns out the camera can be moved by the arrow keys, so my question should be how to add WASD key control to the camera?)
    (Edit 2: I figured this out already, just push the WASD key code to the keysUp/Down/Left/Right array)
  2. Move and look around by dragging on screen and enter VR mode by VR button. Currently VR experience can be provided on Android device, but the VR button does not show up on iOS
  3. Camera travels through meshes even Check Collision is enabled
    I’ve tried both Universal Camera and Virtual Reality, checked “attach control”, checked “enable input” in Scene Controller.

I also noticed there are some errors in my old scripts too but did not get into it yet.

The exported scene by v5 looked much better visually so I would really like to get it to work and migrate to it.

Any help would be appreciated. Thank you.

This one is for @MackeyK24.

Sorry but the new toolkit is NOT compatible with the old toolkit. Most notably the file format has change from native json scene files to GLTF 2.0 (Binary Scene Files) and Script Components are now subclassed from one base class no matter if a light, camera or mesh… The BABYLON.ScriptComponent is the new scripting base class.

I will be working on documentation over this Christmas Break :slight_smile:

1 Like

Thank you for your reply.

I noticed the change in ScriptComponent but it is not my main concern for now. Actually I have removed all my scripts to see what the new Toolkit provides right out of the box.

Right now what bugs me the most is the VR mode in iOS. I thought that’s because WebXR is not supported by iOS, does the Toolkit provide a fallback somewhere or do I have to write my own code to create an old VR helper for iOS?

Also all my meshes exported would not collide with the camera, is there anything needed to be set to have them collide? If I set mesh.checkCollisions = true in code they collide but is that the correct way?

The starter content has a UniversalCameraSystem script component i made to handle MOST camera uses. I used the newer WebXR Experience Helper to handle all the VR stuff. If the WebXR does not do what you need. Just dont use the UniversalCameraSystem and just create your own script.

Collisions… Depend on what you have selected as you Collision System and what Unity Collider is attached to the game object. If using Bullet/Ammo, you will get Collision Shapes created at runtime by the scene manager, if you are using Native Check Collisions, then any meshes with Unity Colliders will have the mesh.checkCollisions set to true.

The camera is a different story. If using my UniversalCameraSystem… then yes you can just enable attach control and if you want to COLLIDE with the ground for example… You may want to enable gravity on the attached camera.

FYI… Everything in the the new toolkit is a script component, i wrote some PRO Class script components to handle Unity’s built in components like Animation State, Rigidbody Physics and Kinematic Character Controller… As you have seen there is also Starter Content which i created as a few basics i use all the time in my projects, so i thought i would make them available to all babylon users, should you want them… You can use them, study them, edit them… whatever… Think of it like Unity has Standard Assets package with things like first person controllers.

I will get on documentation as soon i can (Probably over the Christmas Break)

2 Likes

Finally I decided to use your UniversalCameraSystem with an old VRExperienceHelper.

For the collision problem, switching to “Native Check Collisions” solves it.

I will look forward to the new documentation. Thank you for your hard work.

2 Likes

Man, could you please make a video tutorial on how to create webXR pages with 3D content/video & images that can be both used as VR * AR?
I noticed that the new update has an AR camera, I’d like to at least know how to operate that, if you have to customize the tracker engine, could you please tell us which one we can use and how to codify it, I am willing to pay for a private class, but I believe many of us need it due to OVR and other metaverses that are leaning towards opensource.

2 Likes

@Uve_Deverastegui both VR and AR? Well that’s a pioneering work, nobody can make tutorial yet because nobody knows how to do it properly :slight_smile:
AR isn’t even standardized yet, W3C specs are drafts, etc etc. Authors of both software and content are still trying to make sense of it, i.e. experimenting.
This article summarizes the state of it:

That said, note that this topic is closed, and really issues that you just brought up deserve a lengthy discussion on their own.

Sorry to resurrect this issue, but @jc18 can you provide details on how you achieved this. I am running into issues using webxr on safari browser and would like to create a default camera when creating the scene after device check, but I cant find where excatly in the exported scripts (BabylonManager.js or scene.js) the webxr experience is created.

Or maybe @MackeyK24 can provide guidance on where exactly the camera is created at runtime?

Thanks!!

1 Like

My WebXR stuff was in a script called UniversalCameraSystem in the content/camera folder

1 Like

Thanks, I’ll take a look there. Im not 100% comfortable with typescript so I was trying to look for it in the Js files that are built and exported with the engine.html file