![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | AltoWaltz |
Hello,
I am trying to implement dot product from the documentation: Vector math — Godot Engine (stable) documentation in English
I have a player (2D isometric) and player has a shied and when B key is pressed blocking is active. Problem is that this works even when shield is facing away, so I would like to limit this to maybe half of the rotation.
PA = fire_direction_vector2.direction_to(weapon_direction)
var forward_vector = Vector2(0,1)
var the_object = self
orientation_global = (the_object.to_global( forward_vector-the_object.global_position)
if PA.dot(orientation_global)>0:
print(PA)
fire_direction_vector2 is a player direction vector and weapon direction is an incoming impact vector. Getting seemingly random prints. Any help appreciated.
Cheers.