+2 votes

Hi All and happy Easter!

I am using intersectrey to capture collision points with my grid map (for point and click movement).
I want to detect gridmap tiles underneath the mouse. I've found a method called get_cell_item but cannot get it to work. hovered_point is returned by the intersect
rey method (i'm using position). I get invalid get index 'position' on base 'Dictionary'. I'm guessing this is referring to 'position' being a field in the intersect_ray dictionary and I am able to reference it in other parts of the code, but not here... How does get_cell_item really work?

The code:

func _physics_process(delta):
    var hovered_point = (raycast from mouse collision point).position
    var hovered_tile = gridmap.get_cell_item(hovered_point.x, hovered_point.y, hovered_point.z)
asked Apr 12 in Engine by Macryc (339 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.