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.

Home Forums Official Announcements Verge3D 4.9 pre1 available!

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #80113
    Thomas Fabini
    Customer

    Here is how we do it. You can use this snippet as a basis for your own puzzle or with “exec script”

    Hi Alexander,

    Thank you so much for the snippet!
    After reading through it, as far as I understand, bounding trees is where the magic happens, and then performing closestPointToPoint to find the closest point on the edge of the collision mesh relative to the current position. That’s awesome, being able to query against the outer bounds of the mesh…

    Are bounding trees completely supported already in 4.8.0?
    I was afraid they would not be available in 4.8.0 (which we’re currently using as a stable production version) but after testing I was able to see the data on my collision mesh and even performing closestPointToPoint() on it. I guess I still have to figure out the correct parameters and the details, but if this works it would really mean a huge improvement for non-physics collisions.

    I might try to just exec a short part of code with the collision mesh and current position as parameters and feeding the returned vector to the navigation loop.

    Thanks for pointing this out and good luck with 4.9!

    #80194

    Hi Thomas,
    We upgraded the library that handles raycasting and closest point calculations so that code snippet might not work as expected in 4.8. I’d suggest upgrading to 4.9 pre1 for best results.

    Soft8Soft Tech Chief
    X | FB | LinkedIn

    #80197
    Thomas Fabini
    Customer

    so that code snippet might not work as expected in 4.8

    Hi Alexander,
    thank you very much for pointing that out – I suspected this might be the case.
    I was able to access all the methods but didn’t get past “Infinity” as a result or an shapecast error in the console, depending on the parameters for the closest point calculations. From your snippet I assumed that expected parameters are both Vector3, first with the current position, second one empty for the result.

    I’d love to test 4.9 pre1, but some other projects are still in production under 4.8.0 – might be risky to switch now. I I’ll try to test 4.9 as soon as possible.

    #80199
    kdv
    Participant

    or an shapecast error in the console

    this code (as is) will work correctly only with 4.9.0pre1. and yes, it’s working.

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #80208
    Thomas Fabini
    Customer

    this code (as is) will work correctly only with 4.9.0pre1. and yes, it’s working.

    Hi kdv,

    thanks for confirming.
    Hope I’ll be able to test it soon…

    #80216
    kdv
    Participant

    with some small modifications it will work in 4.8.0 too.

    const tree = mesh.geometry.boundsTree;
    _ppTarget.distance = tree.closestPointToPoint(mesh, _lastIntersection, _ppTarget.point);

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

    #80239
    Thomas Fabini
    Customer

    with some small modifications it will work in 4.8.0 too.

    Awesome, thanks kdv! I’m getting output from closestPointToPoint() with your modifications.
    I only did a quick test running it, hope I’ll be able to get into the details soon.

    #80240
    kdv
    Participant

    to make it work you need just two values: _ppTarget.point (will be rewritten by closestPointToPoint) and _ppTarget.distance (will be returned as a result of closestPointToPoint)

    Puzzles and JS coding. Fast and expensive.

    If you don’t see the meaning in something it primarily means that you just don’t see it but not the absence of the meaning at all.

Viewing 8 posts - 16 through 23 (of 23 total)
  • You must be logged in to reply to this topic.