+1 vote

I have an Area2D as Scene Root and a CollisioinShape2D called Shape as a child. I added a RectangleShape2D as the shape of the CollisioinShape2D .
When I try to set the extend of the RectangleShape2D, it shows "Invalid set index 'extends' (on base: 'RectangleShape2D') with value of type 'Vector2' "
if I use set_extends( Vector2(1, 1) ), it shows *"Invalid call. Nonexistent function 'set_extends' in base 'RectangleShape2D' "*

I checked the type of extends is Vector2 and I don't know which part I did wrong.

my code is like this:

extends Area2D

var width = 10
var height = 10

func _ready():
    get_node("Shape").shape.extends( Vector2(width, height) )
in Engine by (59 points)

1 Answer

+1 vote
Best answer

It's extents with another t:

$Shape.shape.extents  = Vector2(width, height)
by (4,077 points)
selected by

Thank you so much. I am sorry. That is so stupid. I will check the spelling next time @@

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.
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 webmaster@godotengine.org with your username.