Setting RectangleShape2D extends shows error

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Gary_CHAN

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) )
:bust_in_silhouette: Reply From: Dlean Jeans

It’s extents with another t:

$Shape.shape.extents  = Vector2(width, height)

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

Gary_CHAN | 2019-07-08 12:42