Character movement - so many ways to go

Hi everyone.

In general I don’t like best practice questions but in this case, I’m the beginner and I need some infos from experts as google isn’t a big help in this topic. (Coding experience in C# over 10 years / Unity about 1 month).

I’m currently trying to get a full character control working.

I picked this setup so far

  • Camera

  • [Script] MouseOrbit (Camera moves around the player)

  • [Script] ThirdPerson (Player gets rotated to the rotation of the camera)

  • Player (3D Prototype from Magic Pack from Mixamo)

  • [Character Controller] …

  • [Script] FpsWalkerEnhanced (Moves the player around and sends information about the movement-speed in all directions to the animator)

Decision problems

My goal is to get the animations of the Magic Pack running to understand the main concept, then create my own. After setting them up I saw a very unexpected property on the animation objects:

The animation itself can transform the position of my player!!! The FpsWalkerEnhanced-Script got some code to, for example, jump. There is also a jump animation from this package that can transform the body itself.

What should I do in here? Let the animation push my player or do it from code? Letting the animations handle it feels a bit like a static thing I can’t customize at runtime. Maybe there’s no need for that. Also: My camera script is doing crazy things if I enable the transform from the animations. I would need to cover that aswell.

As I’m a beginner and small steps are taking their time. I can’t imagine what kind of problems will occur with which decision. That’s why I’m asking.

What’s the better way in here based on which arguments?

Stuff I would like to do with the character (maybe important to notice)

The animations I’m thinking about are physically not very realistic. I thought about doing things like hovering above the ground while casting a spell, hitting another player with a weapon, hooking up the collision (or trigger) and handling the hit on the enemy. Animating a spell cast that lets the player fly for a short distance to pass gaps and such stuff.

Enough written. I hope someone can point me into a good direction. There is no need to post code for me, I can work out stuff by myself (I anyway appreciate every help in here). I’m just a bit afraid of going the wrong way and wasting time.

Thank you very much

Feedback from an animator who doesn’t code, but has info on the 2 basic character set ups. Either use root motion or use code to drive the position/rotation of the character.

I usually suggest to beginners to experiment with the options available - in this instance it is different control schemes and set ups. Control scheme is an important decision and should be based largely on what the person is most comfortable with and what the character needs to do in game - although I don’t think root motion or code driven have much limitations regarding character control requirements.
I seems sometimes beginners also have this expectation for someone to give them a definitive answer to there question - instead of suggesting to experiment with both and instead giving pointers on the options available.
Anyway -

Question: Is this coding experience in game development or other?
This would be a strong factor in possibly choosing to drive the character with code. You would need (in place) animations and transitions for each animation would be set up by you in code. There would be little need for you to use mecanim, although I think getting accustomed to using mecanim with your code is the best approach. (opinion)

This is up to you. I would create 2 test scenarios with simple solutions. An example is walking your character through a simple maze with 2 obstacles to traverse. A log to jump over and something to crouch under. I’d also suggest (if the final controls call for it) to set up a ladder or jumping/hanging scenario. This is a scenario that might require both root motion and code movement - if using root motion, but might be cleaner looking than using code driven transitions.

I think this isn’t really accurate - only because I’ve worked on a couple projects that use root motion and have had to break down animations into 1/8 movements, quarter turns, intro movement, movement, exit movement, etc etc. I think this largely depends upon the animations you have available and how the controller is set up.
I’ve yet to be involved with a game that NEEDS run time animation customization - so I can’t say if this is a useful thing to have available. I’d say - only if it is needed would this be a consideration.

Yeah - this is something I’d probably remove from your set up and create a custom camera script that worked the exact way you want it to, for both root motion and code driven characters.

In my opinion - making a decision without experimenting - could result in wasted time, however spending time on experimenting with both set ups can not be considered wasted time. And I’d also say - you will find the correct answer you are looking for with much more hands on knowledge to make the decision which is correct for you. :slight_smile:

Wow. What a big answer.
My experience in C# is limited to Winforms/WPF. So I never used it to code games.

Sure I expected something like this is the right way. But only because I’m a beginner and I thought there might BE a real right way. If not, this feels fine to me. You know, sometimes there are new extensions/addons whatever that are bringing really cool features, but are not ready for serious development. I couldn’t imagine if there is anything bad with root-motion (behind the custom-stuff).

Run-time customizing
I thought about jumps on higher or lower places. But you already said splitting animations into parts. Google results for that are very interesting! So my idea of getting custom animation-execution is trash. I just need to split the animations so I can get full control of the start and end depending on the environment.

Your idea of a small level with obstacles to test different movement-schemes isn’t that bad. Sometimes I’m just to impatient to code/test different things. I’ll follow this suggestion and build it up in both ways.

You cleared out a lot for me. Thank you very much for you effort! :slight_smile:

1 Like

The Unity Mecanim Examples have a jump grab example worth looking at for that.

1 Like