Hi, I'm experimenting with some root motion to make some sort of climbing/jumping system.
I'm using Direct Control Sprites Complex Rig with the unity 2d animation system:
The problem is when player moves with root motion, the player script object and collider stays in place. What I'm doing wrong?
Comments
While you may get by with basic root motion on a 2D character, the built-in character motion system isn't intended for climbing / jumping mechanics. It's likely you're going to want to write or implement a custom motion controller to move the character with instead.
But it looks like the issue from your screenshot is that your Animator is not on the character's root object. Root motion will affect the position of the Animator GameObject, meaning the "My New Player" object is unaffected.
I tried using the movement from the Brackeys tutorial and it worked really smooth. It's just 2 additional scripts:
But being moved with a third party script, now the player can move freely during "pause gameplay" cutscenes and can't be constrained with the "Engine: movement:disable". Any idea how can I get around this?
You'll need to update the scripts to account for both of these things, but they're both simple to check for.
To check if you're in normal gameplay:
To check if the "Movement" system has been disabled:
Wow, thanks! I got it working, which considering I can't code at all is pretty great. I can recommend this method to anyone who is looking at more platform feel adventure. The only drawback I can think of now is that looks like Move to Point don't work. Guess I can use Timeline animation or something if it's needed
With a bit more code-tweaking, it should be possible.
If you're using a custom motion controller (i.e. the character's Motion control field it set to Manual), then they won't automatically move when commanded to by AC.
In this situation (which is typically when the game is not in gameplay, i.e. the opposite of the above code), you have to read the Player script's GetTargetPosition() function, which returns the position that AC wants them to be in, and then have your custom motion controller make use of it.
However, a "quick and dirty" method - which won't always work, mind you - is to simpy have the above Motion control field switch back to Automatic whenever you're not in gameplay. This would mean that AC takes control during cutscenes, and your custom controller takes over during gameplay.
Something like:
(Not very optimised, but can be made so if this approach works)
I ended up getting Bolt, and with your awesome help and tips managed to develop a pretty cool character controller, and integrate its movement it with AC - pausing controller in cutscene, walk to direction, face direction etc. Thanks a lot!
Sounds great, thanks for the update.
I'm sure anything you'd be willing to share on the community wiki would be welcome by others.