Hi,
I've got a player with raycast2d (laser2d) and where it's ray collides with level walls I'm dynamically positioning another raycast2d (bounce_one), and want the new one to be casting as if it was a reflection of the first one from the wall (see image below). I can position it in the right place, I just can't seem to get it to face where it should. I would greatly appreciate any advice.
Script sits on players node.
if laser2d.is_colliding():
var laser_coll_point = to_local(laser2d.get_collision_point())
var laser_coll_normal = to_local(laser2d.get_collision_normal())
bounce_one.position = laser_coll_point
var reflection = (laser_coll_point -
to_local(laser2d.position)).reflect(laser_coll_normal)
var angle = laser_coll_point.angle_to_point(reflection)
bounce_one.rotation = rotation + angle
Screen link