Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | cardoso | |
Old Version | Published before Godot 3 was released. |
I am using something like
player.shape.collide(
player.get_transform() * player.shape_node.get_transform(),
enemy.shape,
enemy.get_transform() * enemy.shape_node.get_transform() )
but I would also like to know the ‘direction’ (left/right or above/below) of the collision
I know there is a collide_and_get_contacts()
method for Shape2D, but I can’t seem to use it in a helpfull way.
Are your Shape2Ds parented to a PhysicsBody2D? For example, KinematicBody2D has get_collision_normal()
which would be a useful way to get collision direction.
kidscancode | 2017-08-14 02:05
Thanks, it’s a great idea!
My code does use a KinematicBody2D as the holder of the shape.
Unfortunately I am setting the trigger of the shape to true, which causes the get_collision_normal()
, is_colliding()
, etc methods to not report coliisions.
ps: kidscancode? Uau, last week I was checking a video/blog post from you! Very usefull.
cardoso | 2017-08-14 14:35