is there a way to use different sprites to rotate the ai object (player) so that when it turns 45 degrees he uses a pre rendered 3d asset in 2d with walk animation?(Unity 2d)
Hi
That is a pretty specific request, so there is no built in way to do this.
But you write a script which figures out the angle that the character is headed in and displays an appropriate asset. Something like
var lastPos;
void Update () {
var delta = transform.position - lastPos;
lastPos = transform.position;
var angle = Mathf.Atan2(delta.y, delta.x)*Mathf.Rad2Deg + 180; // Note x and y are swapped
// Angle will go from 0 to 360 degrees
if (angle < 0.5*45) {
// Walking to the right
} else if (angle < 1.5*45) {
// Walking up to the right
} // ...
You can then set the sprite on an image component or something like that to show the animation.