-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collider returns an Object. no access to .Name #28318
Comments
I had a discussion with @nathanjwtx on Discord about this issue and to clarify, it is about the binding for |
This property is defined in |
I think the collider can be |
Wouldn't then just clarifying the different return-types in the documentation improve these misconceptions? |
@akien-mga At least for the |
@neikeq What property do you mean? I don't see any But I can confirm that extends KinematicBody2D
var vel = Vector2(0, 10)
func _physics_process(delta):
var col = move_and_collide(vel)
if col:
print(col.collider) # prints [TileMap:1162] on collision |
Maybe we can introduce a common interface like |
@akien-mga My mistake, the classes are |
@neikeq So yeah, I can confirm that godot/scene/2d/physics_body_2d.cpp Lines 1549 to 1560 in c26f0c9
I guess you thought it's a godot/scene/2d/physics_body_2d.cpp Lines 1561 to 1573 in c26f0c9
I can confirm that in the case of TileMap, it can't retrieve the shape:
We could probably make |
I followed all the code paths that assigned Edit: Just checked again. Yes, I missed some usages... 😑 |
You should be able to cast |
Godot version:
3.1 Mono
Windows 10, i5, GTX1050
Trying to convert the following into C#:
var collision = get_slide_collision(idx) if collision.collider.name == 'Danger':
KinematicCollision2D collision = GetSlideCollision(i);
Doing
collison.Collider
doesn't expose the name property.The text was updated successfully, but these errors were encountered: