Hey, I was wondering to what angles each default direction (L, UL, U, UR, R, DR, D, DL) correspond. I'm working with both direction integer AND body angle float for my animations, so knowing which is which would be useful. Are they calculated by evenly dividing 360 deg into the number of directions the character has, or is there some other logic?
Also if maybe there's a way to change those? EG: if I want L direction integer to kick in between 65 and 115 of body angle instead of whatever it is by default. It would be ok if I can change for the whole project, I'm not looking to fine-tune it for each character. Although I suppose that if it's calculated it would be pretty math intensive to customize it.
thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Not sure how to edit. I want to add that I just run into a case that apparently disimisses the possibility that the direction int depends on 360 divided equally.
I have a character with 6 directions (excludes U and D), so each direction should be 60 degs, theoretically placing each threshold at: 0 - 60 = DL, 60 - 120 = L, 120 - 180 = UL, 180 - 240 = UR, 240 - 300 = R, 300 - 360 = DR.
But I just got the character turned just right to run into this: https://imgur.com/a/rcuMuiZ
Angle 293 = Direction 5
Direction 5 is of course DR, but by the equal subdivision it should be R.
So back to my question above, I guess. I need a precise way to predict which angles correspond to which directions
Maybe I could test it myself but I didn't find a way to manually tweak the angle at runtime in a way that triggers the animation controller.
thanks!
The Manual's "Character animation (Sprites Unity Complex)" chapter details the values that the "Direction integer" and "Body angle float" parameters can take.
The "Direction integer" essentially divides the 360 degrees into 8 discrete values. These values are normally evenly split, unless you have Character rotations affected by 'Vertical reduction factor?' checked in the Settings Manager.
For a character that uses a different direction system (e.g. 6 directions, no up/down), you're better off solely using "Body angle float".
If you want to adjust things further, you can have your character's transitions based on a separate, custom, parameter e.g. "Angle_Adjusted" that copies the regular Angle parameter and makes an adjustment through scripting, i.e.:
I took your advice and worked around the parts that were still using the direction int and make them use angle instead. I think it's cleaner this way, and more consistent/predictable
thanks!