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.

v3d.ConvexGeometry

Home Forums Programming v3d.ConvexGeometry

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1718
    Yaroslav
    Participant

    When trying to call an empty constructor, i keep getting the following error:
    Uncaught TypeError: v3d.ConvexGeometry is not a constructor

    I am using an example from the docs, nothing spectacular in the code. What might be the case?

    #1719

    This class is not included in the core of the engine. You should link the corresponding JS file first:
    examples/js/geometries/ConvexGeometry.js

    Chief 3D Verger | LinkedIn | X

    #1722
    Yaroslav
    Participant

    Thanks, made that thing to work.

    #82069
    David Duperron
    Customer

    Hi Yuri!
    Where and how do you link these additionnal classes files??
    Thanks for the help!

    David

    #82072

    Hi David,

    Please note that this older code is no longer officially supported, but you can give it a try:
    https://github.com/Soft8Soft/verge3d-code-examples/blob/master/jsm/geometries/ConvexGeometry.js

    Chief 3D Verger | LinkedIn | X

    #82117
    David Duperron
    Customer

    Hi Yuri,
    Yeah I know, still the same subject. But What I am struggling with is to be able to import these classes in order to be able to use them in my Puzzles (with javascript puzzles indeed).
    I’ve managed to import these classes using:
    import('./js/lines/Line2.js').then((Lines2Module) => { do something with Lines2Module.classes});
    It works fine, but it is “temporary” and if I need to re-use the same classes later I need to re-import them and do what I want.
    Is there a way to permanently import these additionnal classes and use them when needed in my Puzzles?
    I know this is more a pure javascript question, but probably someone has the answer out there!
    Cheers

    David

    #82122

    Hi,

    Indeed, the examples in the repo are intended for module-based loading (hence the “jsm” folder). You might try non-module versions for your app instead. They were available in the repo before Verge3D 4.3 (use d90282ee6bd4f00959665fefe986ded799ee5122 commit ID to checkout the “js” folder that contains them).

    Alternatively, you can refactor the “modularized” versions making the work as vanilla js scripts.

    Soft8Soft Tech Chief
    X | FB | LinkedIn

    #82123
    David Duperron
    Customer

    Hi!
    Thank you for that! I guess I figured out by myself how to “demodularize” the files by adding the v3d namespace to the classes that were already included in v3d.js (instead of importing them).
    But I was missing the v3d.Line2 = Line2; at the end to make the new class available… I learn new things everyday! :p

    #82124
    David Duperron
    Customer

    And by the way, these line2 and LineGeometries are really worth including in your base classes I think. They allow very nice things for line rendering, which look much better than the line rendering which is provided now… but perhaps I’m missing other problems.
    Anyway for my own App, it is now working perfectly.

    #82128

    Glad you worked it out! Regarding Line2, we need to think about it (need some more use cases to justify placing it in Verge3D runtime).

    Soft8Soft Tech Chief
    X | FB | LinkedIn

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