findPick ignores cullHint (2 posts)

  • Profile picture of JWar JWar4p said 1 year, 2 months ago:

    I’m picking my scenegraph from the rootnode onwards. Several Nodes in the tree are set to CullHint.Always. These Nodes are still processed by the picking though. Is this by design or by accident? If it’s by design, how can I work around this problem.

    A possible solution is to commit the following change to Node:

    public void findPick(Ray toTest, PickResults results, int requiredOnBits) {
    		if (children == null || getWorldBound() == null || !isCollidable(requiredOnBits) || !getWorldBound().intersects(toTest) ||cullHint == CullHint.Always) return;
    		// further checking needed.
    		for (int i = 0; i < getQuantity(); i++)
    			children.get(i).findPick(toTest, results, requiredOnBits);
    	}
    

    instead of

    public void findPick(Ray toTest, PickResults results, int requiredOnBits) {
    		if (children == null || getWorldBound() == null || !isCollidable(requiredOnBits) || !getWorldBound().intersects(toTest)) return;
    		// further checking needed.
    		for (int i = 0; i < getQuantity(); i++)
    			children.get(i).findPick(toTest, results, requiredOnBits);
    	}
    
  • Profile picture of normen normen1271p said 1 year, 2 months ago:

    The cull hint is only for rendering, detach the geometry to avoid picking results or check the cullhint when picking.