Question by
Talmagett · Dec 16, 2020 at 12:07 PM ·
rigidbody2dvector2
Rigidbody2D and some vectors
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
Comment
hero Dashes by diagonal to right-up but not to other diagonally directions