Quantcast
Viewing latest article 5
Browse Latest Browse All 40

Directional blocking like in Dark Souls.

I can't figure out how to compare directions between attacks and player's block. I have the direction the attack is going in, the direction the player is blocking towards and if the player is blocking but i'm not sure what i need to compare these values. I'd like the player to block relative to their block direction -90 and 90 to either side of y direction. attackdirection = transform.eulerAngles.y-180; blockdirection = player.transform.eulerAngles.y; if (attackdirection >= blockdirection-90 && attackdirection <= blockdirection+90) block = 1; This code is in OnTriggerStay for attack. The code would look similar to that but there might be issues with overflowing which i'm not sure how to fix. There might even be things built into Unity that i could use that i'm not aware of.

Viewing latest article 5
Browse Latest Browse All 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>