this code not working when XPos and YPos are -1,-1 or -1,1 or 1,-1 but work when it’s 1,1
public float DashMagn=200f;
private void HeroMove()
{
XPos = Input.GetAxisRaw("Horizontal");
YPos = Input.GetAxisRaw("Vertical");
if (Input.GetKeyDown(KeyCode.Space))
{
HeroRb.AddForce(new Vector2(XPos, YPos) * DashMagn, ForceMode2D.Impulse);
}
and if i try to
HeroRb.AddForce(new Vector2(-1, -1) * DashMagn, ForceMode2D.Impulse);
works