Git Product home page Git Product logo

Comments (6)

deltakosh avatar deltakosh commented on May 14, 2024

You're ABSOLUTELY right :) I'll fixed it right now^^
The code for Matrix.OrthoOffCenterLHToRef is in babylon.math.js. Here is the code:

BABYLON.Matrix.OrthoOffCenterLHToRef = function (left, right, bottom, top, znear, zfar, result) {
    result.m[0] = 2.0 / (right - left);
    result.m[1] = result.m[2] = result.m[3] = 0;
    result.m[5] = 2.0 / (top - bottom);
    result.m[4] = result.m[6] = result.m[7] = 0;
    result.m[10] = -1.0 / (znear - zfar);
    result.m[8] = result.m[9] = result.m[11] = 0;
    result.m[12] = (left + right) / (left - right);
    result.m[13] = (top + bottom) / (bottom - top);
    result.m[14] = znear / (znear - zfar);
    result.m[15] = 1.0;
};

from babylon.js.

Temechon avatar Temechon commented on May 14, 2024

Thank you David :)
Maybe I was not clear in my second sentence, I found the code of this function, but couldn't find the issue in it.

Anyway, do you know why I can't have an orthographic camera on X or Y axis looking at my scene ?

from babylon.js.

deltakosh avatar deltakosh commented on May 14, 2024

Strange...could you share you code so I can try to find the issue?

from babylon.js.

Temechon avatar Temechon commented on May 14, 2024

Nothing fancy here. Here is my code :

var canvas = document.getElementById("renderCanvas");
var engine = new BABYLON.Engine(canvas, true);
var scene = new BABYLON.Scene(engine);

// Camera on Y axis looking at (0,0,0)
var camera = new BABYLON.FreeCamera("Cam", new BABYLON.Vector3(0,-10,0), scene);
camera.setTarget(new BABYLON.Vector3.Zero());

var box = BABYLON.Mesh.CreateBox("box", 1, scene);
box.position = new BABYLON.Vector3(1, 0, 0);

var renderFunction = function () {
          scene.render();
};
engine.runRenderLoop(renderFunction);
camera.attachControl(canvas);

When I execute this code, nothing is displayed. I have to attach a control to the camera and rotate the view to see my scene.

from babylon.js.

deltakosh avatar deltakosh commented on May 14, 2024

Ohh I know this bug :) This is related to maths^^
just move the box a little bit just to ensure the box is not perpendicular to its target:

camera.setTarget(new BABYLON.Vector3(0, 0, 0.001));

from babylon.js.

Temechon avatar Temechon commented on May 14, 2024

Perfect, it's working great :)

Thank you !!

from babylon.js.

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.