Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | TalonGameDev |
using Godot;
using System;
using System.Collections.Generic;
using Godot.Collections;
public class MouseEvents : Node2D
{
public override void _PhysicsProcess(float delta)
{
Vector2 mousePos = GetGlobalMousePosition();
var spaceState = GetWorld2d().DirectSpaceState;
Godot.Collections.Array result = spaceState.IntersectPoint(mousePos, 30, new Godot.Collections.Array {}, 2147483647, true, true);
if(result.Count > 0){
GD.Print(result[0].collider); //shows error "Object does not contain a definition for 'collider' and no accessible extension method 'collider' accepting a first argument of type 'object' could be found"
GD.Print(result[0]["Collider"]); //Shows error "Cannot apply indexing with [] to an expression of type 'object'"
}
}
}
I don’t understand why it doesn’t work. When I print out result[0].GetType(), it prints that it is of type Dictionary. I’m using Visual Studio Code. Also, Intellisense only displays .Equals, .GetHashCode, .GetType, and .ToString as available methods after typing result[0].