Jump to content

Frustum plane undefined


Vousk-prod.
 Share

Recommended Posts

Hi everybody,

When I use 2.5 beta, on some projects I get a frustumPlanes[p] is undefined  error, in this method :

The problem doesn't occur in 2.4 final. I think it first occured from commit 3afb8d05108e032c285136a216bf98cb718419da "Added camera.isInFrustum and camera.isCompletelyInFrustum"

BoundingBox.IsCompletelyInFrustum = function (boundingVectors, frustumPlanes) {
  for (var p = 0; p < 6; p++) {
    for (var i = 0; i < 8; i++) {
      if (frustumPlanes[p].dotCoordinate(boundingVectors[i]) < 0) {
        return false;
      }
    }
  }
  return true;
};

For now I didn't manage to figure out what the difference is between projects where this error occur and those where there is no problem.

Link to comment
Share on other sites

I was trying to use camera.isInFrustum today and found it was culling things which were actually still on the screen... not sure if that's related. I gave up using it for now without too much investigation.

Link to comment
Share on other sites

Nope, I cannot be able to reproduce it, it really occurs only on some projects. I noticed something else, maybe it's related, when we define an "empty mesh", eg. a mesh with no vertex at all, but declared as a mesh and not a abstract one (because it is produced from the blender exporter and not by hand), the iscompletlyInFrustum functions act strangely, as if the bounding box has a default size unrelated to the zero size of the mesh.

Link to comment
Share on other sites

  • 1 month later...

The frustumPlanes[p] is undefined  error was simply related to a major change between 2.4 and 2.5 function signatures :

AbstractMesh.prototype.isCompletelyInFrustum = function (frustumPlanes) for 2.5
AbstractMesh.prototype.isCompletelyInFrustum = function (camera) for 2.4

But Dal is right, camera.isInFrustum is culling things which are actually still on the screen, and same with abstractMesh.isInFrustum (but differently
Maybe the camera's frustumPlanes are not correctly updated or something like that.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...