Jump to content

Beginner questions


²Digitalgames
 Share

Recommended Posts

Thanks Deltakosh. Thats pretty cool ! 

 

How do i use it inside a function ?

// Mouse Over and Out Function action               var mouseOverUnit = function(unit_mesh) {                 console.log ("mouse over "+unit_mesh.meshUnderPointer.id);                 console.log (unit_mesh);                 if (unit_mesh.isPickable = true) {                 console.log (unit_mesh);                 var geometry = unit_mesh.geometry.copy('new_geo');	               var outline = unit_mesh.clone();	               outline.geometry = geometry;                console.log(outline.geometry);	              outline.flipFaces(true);	              outline.scaling = new BABYLON.Vector3(1.05, 1.05, 1.05);	              outline.material = redMaterial;	              outline.visibility = 0.5; }

This does not work. The console says 20:01:05.316 TypeError: unit_mesh.geometry is undefined1 FinalScene.js:43:21

This is of course i don´t know what i am doing and walking inside darkness trying to find a light switch  :D

 

Edit :  I found it , i erased .source from unit_mesh.source etc. I did not notice it because unit_mesh.isPickable did work. Will write back after testing around

Link to comment
Share on other sites

Hm, thats not what i wanted to do. It scales up the mesh, and that does not look well in this situation. (As shown below on the attached picture)

          // Mouse Over and Out Function action               var mouseOverUnit = function(unit_mesh) {                 console.log ("mouse over "+unit_mesh.meshUnderPointer.id);                 console.log (unit_mesh);                 if (unit_mesh.source.isPickable = true) {                 unit_mesh.source.renderOutline = true;                 unit_mesh.source.outlineWidth = 0.0025;                 unit_mesh.source.renderingGroupId = 1;      }    };               var mouseOutUnit = function(unit_mesh) {               console.log ("mouse out "+unit_mesh.meshUnderPointer.id);               console.log (unit_mesh);               if (unit_mesh.source !== null) {                 unit_mesh.source.renderOutline = false;                 unit_mesh.source.outlineWidth = 0.0025;                 unit_mesh.source.renderingGroupId = 0;      }    };

This worked. I will post a full code sample later on for other users that wanted to archieve something like this. Thanks for all the help. After all i think i now have all the basics that are needet for my small projects. 

post-17361-0-17884800-1452023982.jpg

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