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.

How to call a V3D function from outside the iframe?

Home Forums Programming How to call a V3D function from outside the iframe?

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #19783
    D3PixelD3Pixel
    Licensee

    Hi

    How can i access Verge3D functions from the parent doc outside the Verge3D iFrame?

    I thought I could do:

    This doesn’t work though.
    Thanks for any help.

    • This topic was modified 1 year ago by D3PixelD3Pixel.

    3D Animation and Web3D services - www.d3pixel.co.uk

    #19786
    Yuri KovelenovYuri Kovelenov
    Developer

    You can access app methods via v3d:

    var object = win.v3d.apps[0].scene.getObjectByName("Box01");

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #19788
    D3PixelD3Pixel
    Licensee

    Brill, thanks so much for the quick answer Yuri!
    :yahoo:

    3D Animation and Web3D services - www.d3pixel.co.uk

    #19795
    D3PixelD3Pixel
    Licensee

    Object now works but object.material is undefined.

    I have R.G.B. values from HTML and just want to change the color node “RGB” of a Principled material whenever my color picker event fires.

    Or I could call a visual_logic.js function from outside the iFrame somehow? as that contains function setMaterialColor(matName, colName, r, g, b)

    Sorry to ask these questions, next time I will start with a code template and go from there.

    • This reply was modified 1 year ago by D3PixelD3Pixel.

    3D Animation and Web3D services - www.d3pixel.co.uk

    #19799

    Hi,

    is the object “Load Cell Main Body FULL” contains multiple materials? If so, you need to check the object’s children to get yours.

    With regard to the Puzzles functions, I have good news for you. Starting from Verge3D 2.15 you can execute any Puzzles procedures right from the v3d namespace:

    win.v3d.puzzles.procedures.YOUR_FUNCTION_NAME()

    or if it contains spaces:

    win.v3d.puzzles.procedures["YOUR FUNCTION NAME"]()

    Co-founder and CTO at Soft8Soft
    FB | Twitter | VK

    #19804
    D3PixelD3Pixel
    Licensee

    Ah, yes, it contains 3 materials. I will look at how to get the one I want.

    I also tried calling the new puzzle function (assuming you mean one in visual_logic.js)
    win.v3d.puzzles.procedures.setMaterialColor("Mainbody_Black", "RGB",1,0,0);
    and that gave:
    Uncaught TypeError: win.v3d.puzzles.procedures.setMaterialColor is not a function

    I am using: Verge3D 2.15.0 (WebGL 2.0)

    3D Animation and Web3D services - www.d3pixel.co.uk

    #19805
    D3PixelD3Pixel
    Licensee

    Got it.

    var mat = object.children[0].material;

    Not sure how to call visual_logic puzzle functions as you mentioned though.

    3D Animation and Web3D services - www.d3pixel.co.uk

    #19806
    D3PixelD3Pixel
    Licensee

    Anyway, I got it working using the v3d app methods and it seems nice and quick.

    Demo
    https://www.d3pixel.co.uk/web3d.html

    3D Animation and Web3D services - www.d3pixel.co.uk

    #19820
    Yuri KovelenovYuri Kovelenov
    Developer

    Glad you worked it out! The app looks great! :good:

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

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