Bugs appeared recently in the last hour

the command new BABYLON.CubeTexture.CreateFromImages(files, scene);
And
new BABYLON.Vector3.Zero()
functions, are not working

It was working one hour ago

Me too. On preview branch.

particle.color = new BABYLON.Color4.FromHexString(‘#f44336’)
Uncaught TypeError: BABYLON.Color4.FromHexString is not a constructor

cc @RaananW

Whole Playground seems to be down at the moment. However both

BABYLON.CubeTexture.CreateFromImages(files, scene);
and
BABYLON.Vector3.Zero()

are static functions and do not require a new command. If they used to work with new and no longer do then this is a bug correction.

1 Like

I’m also getting 404 for textures from https://www.babylonjs-playground.com/textures

This showAxis function is used pretty widely. Can you elaborate on what is obsolete in it?

var showAxis = function (size) {
   var makeTextPlane
   var dynamicTexture
   var plane
   var axisX
   var axisY
   var xChar
   var yChar
   var axisZ
   var zChar
   makeTextPlane = function (text, color, size) {
      dynamicTexture = new BABYLON.DynamicTexture(
         'DynamicTexture',
         50,
         localBase.explain.scene,
         true
      )
      dynamicTexture.hasAlpha = true
      dynamicTexture.drawText(
         text,
         5,
         40,
         'bold 36px Arial',
         color,
         'transparent',
         true
      )
      plane = new BABYLON.Mesh.CreatePlane(
         'TextPlane',
         size,
         localBase.explain.scene,
         true
      )
      plane.material = new BABYLON.StandardMaterial(
         'TextPlaneMaterial',
         localBase.explain.scene
      )
      plane.material.backFaceCulling = false
      plane.material.specularColor = new BABYLON.Color3(0, 0, 0)
      plane.material.diffuseTexture = dynamicTexture
      return plane
   }

   axisX = BABYLON.Mesh.CreateLines(
      'axisX',
      [
         new BABYLON.Vector3.Zero(),
         new BABYLON.Vector3(size, 0, 0),
         new BABYLON.Vector3(size * 0.95, 0.05 * size, 0),
         new BABYLON.Vector3(size, 0, 0),
         new BABYLON.Vector3(size * 0.95, -0.05 * size, 0),
      ],
      localBase.explain.scene
   )
   axisX.color = new BABYLON.Color3(1, 0, 0)
   xChar = makeTextPlane('X', 'red', size / 10)
   xChar.position = new BABYLON.Vector3(0.9 * size, -0.05 * size, 0)
   axisY = BABYLON.Mesh.CreateLines(
      'axisY',
      [
         new BABYLON.Vector3.Zero(),
         new BABYLON.Vector3(0, size, 0),
         new BABYLON.Vector3(-0.05 * size, size * 0.95, 0),
         new BABYLON.Vector3(0, size, 0),
         new BABYLON.Vector3(0.05 * size, size * 0.95, 0),
      ],
      localBase.explain.scene
   )
   axisY.color = new BABYLON.Color3(0, 1, 0)
   yChar = makeTextPlane('Y', 'green', size / 10)
   yChar.position = new BABYLON.Vector3(0, 0.9 * size, -0.05 * size)
   axisZ = BABYLON.Mesh.CreateLines(
      'axisZ',
      [
         new BABYLON.Vector3.Zero(),
         new BABYLON.Vector3(0, 0, size),
         new BABYLON.Vector3(0, -0.05 * size, size * 0.95),
         new BABYLON.Vector3(0, 0, size),
         new BABYLON.Vector3(0, 0.05 * size, size * 0.95),
      ],
      localBase.explain.scene
   )
   axisZ.color = new BABYLON.Color3(0, 0, 1)
   zChar = makeTextPlane('Z', 'blue', size / 10)
   zChar.position = new BABYLON.Vector3(0, 0.05 * size, 0.9 * size)
}

Thanks

There is now a built in method to display axes

const axes = new BABYLON.AxesViewer(scene, length_of_axes)

Also BABYLON.Mesh.CreatePlane and BABYLON.Mesh.CreateLines, used several times in the showAxis function, are now depreciated. However because of the importance of backwards compatability within Babylon.js you can continue to use the showAxis function as it is if you wish to.

1 Like

Very cool. Thanks John.

Those are not constructors, so new is actually incorrect.

The playground should be online and working. is it still offline for you?

same this should not have a new in from of it, this is just a function call not an instantiation.

I could be wrong here as there could be exceptions to the rule, but the general convention is:
BABYLON.ClassName

BABYLON.ClassName.method (camelCase)

BABYLON.ClassName.FactoryMethod (ProperCase)

You need new for ClassName and don’t need “new” for FactoryMethod(…) to create new classes.

3 Likes

Yup and currently @RaananW is working on pushing our previous way of building in es5 which was a weird side effect alllowing the syntax (despite not being correct) hence the regression.

it should be deployed in a few minutes. Having said that, I would recommend you not to use this syntax :slight_smile: