We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

assignMat for second time fails?

Home Forums Bug Reports and Feature Requests assignMat for second time fails?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #41965

    Hi Verge!

    First of all, thank you for great version 3.7! I am very happy with all new functionality!

    Im trying to make custom configurator for our customers running through iframe. I tried to mimic demos simple configurator and Recliner which are doing exactly what I need. Triggering geometry through puzzle is working, however when I try to change material on some objects via assignMat in visual_logic.js it works only the first time i make this change. Any change of material for the second time fails and does not happen. Seems bit odd to me.

    Relevant lines 594 in my visual_logic:

    eventHTMLElem('click', 'button1', true, function(event) {
      assignMat('Sphere', 'zlato');    
      assignMat('Cube2', 'zlato');    
      assignMat('Cube', 'zlato');    
        assignMat('Sphere', 'zlato');
      } else {
        assignMat('Sphere', 'zlatonormal2');
    eventHTMLElem('click', 'button3', true, function(event) {
        assignMat('Sphere', 'zlatonormal2');
        assignMat('Cube2', 'zlatonormal2');
        assignMat('Cube', 'zlatonormal2');

    Im attaching full demo as zip – plrease refer to index.html which is nesting configurator.html in iframe.

    It seems like material is not visible second time it is attached to the object: function assignMat returns on this line:

        var mat = v3d.SceneUtils.getMaterialByName(appInstance, matName);
        if (!mat)

    This does not happen first time material is attached though.

    Please can you help me resolve this issue?


    Attachement was blocked, here is link to it: http://skygazer.eu/precismo/configurator/configurator.zip


    Because zlato2 material exist only on the sphere and you replace it by zlato material it just not present anymore on the scene. Assign all materials to a simple invisible object that you will always keep unchanged.

    Co-founder and lead graphics specialist at Soft8Soft.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.