I want to have the player interact with some object in the scene, now my thought is to implement some custom member function(let's call it Action()
) in the object's script, and when interaction key is pressed, find a suitable object with Area2D.GetOverlappingBodies()
and some custom algorithm, then call the object.Action()
to trigger the process, but PhysicsBody2D
cannot be casted to the inherited object class, how should I get this done?