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.

Change initObjectPicking inside visual_logic.js

Home Forums Puzzles Change initObjectPicking inside visual_logic.js

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #48773
    jamjam
    Customer

    Hey,

    is it possible to set this variable in initObjectPicking inside visuals_logic.js from false to true with puzzles?

    Its the variable in the last line:
    }, 'mousemove', false);

    Right now, we change it manually inside the .js file, but would prefer to set it in puzzles.

    // whenHovered puzzle
    initObjectPicking(function(intersects, event) {
    
        var prevHovered = _pGlob.hoveredObject;
        var currHovered = '';
    
        // the event might happen before hover registration
        _pGlob.objHoverInfo = _pGlob.objHoverInfo || [];
    
        // search for closest hovered object
    
        var lastIntersectIndex = Infinity;
        _pGlob.objHoverInfo.forEach(function(el) {
            var maxIntersects = el.xRay ? intersects.length : Math.min(1, intersects.length);
    
            for (var i = 0; i < maxIntersects; i++) {
                var obj = intersects.object;
                var objName = getPickedObjectName(obj);
    
                if (objectsIncludeObj(retrieveObjectNames(el.objSelector), objName) && i <= lastIntersectIndex) {
                    currHovered = objName;
                    lastIntersectIndex = i;
                }
            }
        });
    
        if (prevHovered == currHovered) return;
    
        // first - all "out" callbacks, then - all "over"
        _pGlob.objHoverInfo.forEach(function(el) {
            if (objectsIncludeObj(retrieveObjectNames(el.objSelector), prevHovered)) {
                // ensure the correct value of the hoveredObject block
                _pGlob.hoveredObject = prevHovered;
                el.callbacks[1](event);
            }
        });
    
        _pGlob.objHoverInfo.forEach(function(el) {
            if (objectsIncludeObj(retrieveObjectNames(el.objSelector), currHovered)) {
                // ensure the correct value of the hoveredObject block
                _pGlob.hoveredObject = currHovered;
                el.callbacks[0](event);
            }
        });
    
        _pGlob.hoveredObject = currHovered;
    }, 'mousemove', true);
    
    

    Thanks

    #48893
    jamjam
    Customer

    Bump, in case it got overlooked.

    #48894

    Hi and sorry for the delay. I think there were reasons why this setting is not exposed in the puzzle. Yet it is possible to modify the puzzle’s underlying code by creating a custom puzzle. It should be straightforward: you could possibly copy the code from the original puzzle and only modify that setting.
    See here for more details: https://www.soft8soft.com/docs/manual/en/puzzles/Plugins.html

    Chief 3D Verger | LinkedIn | Twitter

    #48895
    jamjam
    Customer

    Thanks Yuri :good:

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