Jump to content

Return a mesh


Kilombo
 Share

Recommended Posts

Good morning everyone,

 

I'm trying to return a mesh from one object to the main scope, something like.

unit.prototype.getMesh = function(){     return this.mesh;}.....main scope:unit1 = new unit();..all the operations with the unit (load mesh, etc...)..console.log (unit1.getMesh());

Problem is.... this doesn't work, returns undefined, but... if I put a console.log(this.mesh) on the getMesh method, I do get the mesh on the console. Strange..... The problem is.. I do need to return the mesh, because I need to test the intersection between that mesh and another one.

 

Ideas anyone?

 

Thanks in advance.

Link to comment
Share on other sites

Forget it.. it's solved, it was something related to how javascript works.

 

Javascript was actually trying to do getMesh() before the mesh was loaded, solved with a if (typeof !== undefined).

 

But I still have a problem.

 

The Blender imported meshes don't seem to have _boundinginfo. So i'm not beeing able to test the intersection. Is this a bug, or I really have to parent a new bounding box to the mesh?

Link to comment
Share on other sites

It has I wasn't doing right, I already posted another question about this. I'm not beeing able to put the intersect working with moveWithCollisions, something is missing, i'm doing something wrong, i just can't figure it out yet.

Thanks anyway Delta. :)

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...