[SOLVED] NullEngine and screen space calculation

enforced issue with my screen space calculation inside NullEngine.

const engine = scene.getEngine();
const scaling = engine.getHardwareScalingLevel();

const pos = Vector3.Project(
            new Vector(5, 10, 3),
        pos.x *= scaling;
        pos.y *= scaling;
        pos.z *= scaling;
        return pos;

works well in browser but in NullEngine always returns Vector3(x: NaN, y: NaN, z: NaN).
Doing something wrong or its by design so?
Thank You

My camera settings

this.scene.activeCamera = new ArcRotateCamera(
      "camera", 0, 0, 100, Vector3.Zero(), this.scene,

I’ll have a look

1 Like

The scene.getTransformMatrix() must return an empty matrix I guess as the camera was not activated (probably).

You can replace scene.getTransformMatrix() by camera.getTransformMatrix()

@Deltakosh Thank you for answer, yes you were right, called this.scene.render(true); after creation so works well now

1 Like