0 votes

I am trying to get the y position of the Area2D that the player collides with, however I keep receiving "Invalid call. Nonexistent function 'Vector2' in base 'Area2D'." Does Area2D not have Vector2?

func _on_LedgegrabHook_area_entered(area):
     var ledgegrabPos = area.Vector2()

Apparently Area2D does not have a Vector2 property, however I have attached a CollisionShape2D node to it which should have one. How would I get the Vector2 of a subnode? when the player enters the Area2D?

Godot version 3.4.2
in Engine by (20 points)

1 Answer

0 votes

Vector2 is not a property - it's a data type. For your question, an Area2D (and anything else that extends Node2D) has a position property that IS a Vector2. I assume that's the property you're looking for. So, you probably want this:

var ledgegrabPos = area.position.y

by (16,804 points)
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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.