Forum rules - please read before posting.

Is there a way yet to rotate NPCs as they move along a path?

I asked this a while back and it wasnt a feature but im just asking again in case. Lets say I have a snail I want to climb walls etc, is there any way, or will there ever be a way, to have the NPC rotate so it can go along the floor then up the wall for example? Even an ugly work around would work :)

Comments

  • I don't think there'd be a way to do this gracefully without doing a custom animation for the whole thing, to be honest.
  • Ahhh, why is it such an issue? seems strange, I will work out another way I guess :)
  • I have a similar issue. I have an NPC beetle running over a wall, following a path with many turns. I have a single Sprites Unity Complex animation of the beetle. I would like him to be always head first in the current direction. Is it possible to rotate the NPC in 8 directions somehow, using only a single "walk" animation? Or do i need to create 8 walk animations, each in a different direction?

  • You can have a single walk animation, and then control the rotation of the sprite child separately.

    With Sprites Unity Complex, you have access to "Direction" integer and "Body angle" float parameters, which will be updated as the character turns. See the Manual's "Sprites Unity Complex animation" chapter for details on what values these take.

    What you could do is have separate up/down/left/right etc animations that simply set the rotation of the sprite child, put these in a sub-layer, and then control playback via one of the above parameters. That would cause both the walking animation, and the facing animation, to play simultaneously.

    You may have problems, however, if the NPC moves in a given direction both normally and upside-down. Can you share screenshots of the situation?

    If this is the case, it may be better to rely either on a custom script to handle rotation, or move the character using Timeline, so that you can control the position and rotation simultaneously.

  • Thank you. I didn't use Direction in the end because I could not, for the love of god, find the "Diagonal sprites?" setting anywhere. So, instead, I went with Angle. I created a new layer in Animator that switched between animations that turned the whole rig based on angular intervals. Gave this layer weight 1. And it seems to work nicely :-)

  • Where are you finding mention of a "Diagonal sprites?" option? An old forum post, or is it in the Manual?

    This was an old option in the character Inspector, but it's since been replaced with the Facing directions dropdown that gives you more control over the directions a character can face.

  • In the Manual v1.82.0. It's good to know why I couldn't find it :-D
    Is there a way to make the NPC turn smoother? The only thing that comes to mind is making even more directions than 8. But is that even possible when 8 is the maximum to set in facing directions?

  • Smooth turning isn't about the number of directions - rather, by adding transition animations between them.

    For example, if the Move Speed is 0, the Direction is currently 2 (Right), and it switches to 1 (Left), playing a "turn right-to-left" transitions will make it smooth. It's a case of leveraging the parameters to play animations at the right time.

  • Sorry, I didn't phrase it properly. I have a very crooked path that the NPC (a beetle) is supposed to follow on a wall. With the current setting of 8 directions, the rotation of the rig is limited by these directions. But I would like the beetle to turn precisely to any angle created by this path. The transitions between the 8 directions are smooth, but the rotation of the body is still limited by 45 degrees, and the movement doesn't look as natural as I'd like it to.

  • As it's a visual issue, any video/screenshots you can share to illustrate it will help clarify the situation.

    AC won't control the rotation of your assigned "sprite child", so it may be that you can look into a custom script that handles the rotation of the rig - rather than embedded it in the animations. The rotation could be set based on the direction of movement, smoothed out to appear more natural.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.