Getting the actual shape of a collision shape? (Godot4)
Asked Answered
R

1

0

How do you get the size and/or position of a CollisionShape2D? The docs say shape or get_shape(), but this does not give me a vector or something, when trying to print it only ever results in its ID number. <RectangleShape2D#-9223....bunchanumbers>

Googling "How to get shape/size/Vector/position of CollisonShape2D" says something about 'extents', but that seems to not exist in Godot 4 anymore.

Runny answered 22/2 at 17:13 Comment(0)
R
0

Runny WELP, 3 seconds later i figured it out:

CollisionShape2D.get_shape().get_size()

edit: In case any other newbies are confused by this: You first have to get the shape that is assigned to the CollisionShape2D (i.e. a Rectangle or Circle or Polygon), THEN you can get the shape of that shape. Not the CollisonShape itself, but the shape set inside the collision shape... yeah. It's confusing.

/close thread

Runny answered 22/2 at 17:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.