system
1
system
4
|
|
|
|
Reply From: |
genete |
Use KinematicBody2D
and call get_collision_normal()
and for the returned Vector2D
calculate its angle by calling its angle()
member.
system
5
|
|
|
|
Reply From: |
ericdl |
To find rigidbody2d collision info you can override the _integrate_forces
function:
func _integrate_forces(state):
if (state.get_contact_count() > 0):
var position = state.get_contact_local_pos(0)
var angle = state.get_contact_local_normal(0).angle()
print("collision position: ", str(position))
print("angle: ", str(angle))
Or you can use the rigidbody2d body_enter
signal:
func _ready():
self.connect("body_enter",self,"_body_enter")
func _body_enter(body):
var position = body.get_global_pos() #or body.get_pos()
print("collision position: ", str(position))