-
Notifications
You must be signed in to change notification settings - Fork 49
Adding new FinalIK Guide #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
HireMeDeveloper
wants to merge
13
commits into
main
Choose a base branch
from
feature/ThirdPersonDocs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
53b5ede
Adding in the new tutorial markdown files, and videos, plus the sideb…
HireMeDeveloper 701a79a
Adding .idea folders to the .gitignore
HireMeDeveloper e6b036c
removing the .idea folders from repo
HireMeDeveloper 1a74097
reworking the guide and adding in new video files
HireMeDeveloper cc14ac8
Rough draft copy pass on final ik guide.
maxweisel d5e83b6
Adding rough videos to new guide draft
HireMeDeveloper 17e0303
Updating the config to include the new guide draft instead of the old
HireMeDeveloper 1f38e80
Making it multiplayer steps.
maxweisel c7e1aff
Adding in placeholder videos to the making it multiplayer section
HireMeDeveloper c8d696f
Guide copy updates.
maxweisel f206888
Final copy edits on final ik guide. Fix all paths / naming. Fix video…
maxweisel 15cb018
Adding in new video revisions
HireMeDeveloper e64f0c1
Fix formatting of final IK guide copy.
maxweisel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| --- | ||
| layout: docs | ||
| title: Using Final IK | ||
| --- | ||
| # Using Final IK | ||
|
|
||
| Final IK is the most popular Unity asset for adding realistic IK to player controllers in your game. This guide will demonstrate how to create a multiplayer player controller in Normcore using Final IK. | ||
|
|
||
| When you're finished, you'll end up with a multiplayer game that looks like this: | ||
|
|
||
| <video src="./creating-a-player-controller/sphere-player-mouse-jump-6.mp4" width="100%" controls></video> | ||
| (Video demonstrating the steps above) | ||
|
|
||
| We'll start by creating a singleplayer player controller from scratch with Final IK. (TODO: Rewrite the next sentence once the guide is complete) We'll get the controls to feel nice, and then we'll make it multiplayer. If you're only interested in the multiplayer part, skip to [making it multiplayer](#making-it-multiplayer). | ||
|
|
||
| ## Creating a player controller | ||
|
|
||
| Before we can utilize Final IK, we'll need a player controller that allows us to move the player with WASD keys. Create a copy of the Blank Scene Template scene included in the `Normal/Examples` folder. Save it as "Final IK Player Controller". | ||
|
|
||
| Let's start by creating a game object to represent the player. Create an empty game object in the scene named "Player" and add Normcore's built-in **Player** component. | ||
|
|
||
| Add a **Rigidbody** to the "Player" game object so that it can respond to physics. We'll always want our player to remain upright, so let's enable Freeze Rotation on every axis. | ||
|
|
||
| Last, we'll add a Capsule game object to represent the body of the player. Set the y-position at 1 so the bottom is lined up with the ground. | ||
|
|
||
| <video src="./creating-a-player-controller/sphere-player-mouse-jump-6.mp4" width="100%" controls></video> | ||
| (Video demonstrating the steps above) | ||
|
|
||
| Looking good so far! If we enter Play mode, we can use the WASD keys to move our capsule player around. | ||
|
|
||
| <video src="./creating-a-player-controller/sphere-player-mouse-jump-6.mp4" width="100%" controls></video> | ||
| (Video demonstrating the steps above) | ||
|
|
||
| ## Integrating a Final IK character | ||
|
|
||
| Now that we have a player controller that we can move around, it's time to bring in a Final IK character. First, if you haven't already, import Final IK from the asset store. | ||
|
|
||
| Grab a Final IK character from the `Plugins/RootMotion/Shared Demo Assets/Characters` folder and drag it into the scene as a child of the "Player" game object. In this example, we'll be using the Pilot. | ||
|
|
||
maxweisel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Last but not least, let's hide the **MeshRenderer** for the capsule collider. It's important to keep the collider itself enabled so our player doesn't fall through the ground. | ||
|
|
||
| Let's enter play mode and try this out. | ||
|
|
||
| <video src="./creating-a-player-controller/sphere-player-mouse-jump-6.mp4" width="100%" controls></video> | ||
| (Video demonstrating the steps above) | ||
|
|
||
| As we can see, our character is there, but (TODO: how does it fail?). In order for our character to animate correctly, we'll need to set up an animation controller. | ||
|
|
||
| Normcore comes with a built-in animation controller for Final IK. Drag the **PlayerAnimatorController** component from the Unity project into the **Controller** field on the **Animator** component. And to ensure that the **Player** component can drive this animator controller, drag a reference from the "Pilot" game object into the **Character** slot. | ||
|
|
||
| <video src="./creating-a-player-controller/sphere-player-mouse-jump-6.mp4" width="100%" controls></video> | ||
| (Video demonstrating the steps above) | ||
|
|
||
| Much better! This looks good, but Final IK provides a handful of built-in components that we can use to polish this animation even further. | ||
|
|
||
| ## Using Final IK components | ||
|
|
||
| Our character works well, but there are a few places where it falls short. Our character doesn't lean when running in a circle, and if we add a ramp to the scene that our character can walk up, you can see the character's feet don't line up with the ground. | ||
|
|
||
| <video src="./creating-a-player-controller/sphere-player-mouse-jump-6.mp4" width="100%" controls></video> | ||
| (Video demonstrating the steps above) | ||
|
|
||
| Luckily, Final IK comes with a variety of components that can be used to refine the animation of our character. | ||
|
|
||
| On the "Pilot" game object, add a **FullBodyBipedIK** component, a **BodyTilt** component. | ||
|
|
||
| Populate the **BodyTilt** component **IK** field by dragging in a reference to the **FullBodyBipedIK** component. We'll also need to provide a left and right pose. Normcore includes a "Pose Left" and "Pose Right" preset that can be found in the `Normal/Examples/Final IK Player Controller/Character` folder. | ||
|
|
||
| You can adjust the values for **Tilt Speed**, and **Tilt Sensitivity** as you like, but we have found 5.0 for Tilt Speed and 0.2 for Tilt Sensitivity look great. | ||
|
|
||
| <video src="./creating-a-player-controller/sphere-player-mouse-jump-6.mp4" width="100%" controls></video> | ||
| (Video demonstrating the steps above) | ||
|
|
||
| Last, let's add the **GrounderFullBodyBiped** component. Open up the Solver, and set *Layers* to "Default". This is the collision layer used for the solver. As your game grows, you may want to create a dedicated layer for the ground and surfaces you would like your player to land on. | ||
|
|
||
| <video src="./creating-a-player-controller/sphere-player-mouse-jump-6.mp4" width="100%" controls></video> | ||
| (Video demonstrating the steps above) | ||
|
|
||
| Now that both of those components are set up. Let's test it out! Have the player run in a circle and walk up the ramp. | ||
|
|
||
maxweisel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <video src="./creating-a-player-controller/sphere-player-mouse-jump-6.mp4" width="100%" controls></video> | ||
| (Ideally this video is a frame by frame replay of the first video where it didn't work, but now it works) | ||
|
|
||
| Much better! Our character now runs around and looks great doing it, but our camera is left behind. Let's fix that! | ||
|
|
||
| ## Camera controls | ||
|
|
||
| Normcore comes with a built-in component called **PlayerCameraManager**. This component handles all of the logic for moving the camera with your player. It also supplies metadata about where the camera is looking so the **Player** component can correctly handle things like strafing. | ||
|
|
||
| Add the **PlayerCameraManager** component to the "Player" game object and create a child game object called "Follow Target". This will represent the point on the player that the camera should follow. Wire it up to the **Follow Target** slot and we're good to go. (TODO: Player should automatically find the **PlayerCameraManager** component if the're on the same game object) | ||
|
|
||
maxweisel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <video src="./creating-a-player-controller/sphere-player-mouse-jump-6.mp4" width="100%" controls></video> | ||
| (Video demonstrating the steps above) | ||
|
|
||
| Let's test it out! Our camera should now smoothly follow the player and we can use the mouse to adjust the look direction and our player will follow suit! | ||
|
|
||
| <video src="./creating-a-player-controller/sphere-player-mouse-jump-6.mp4" width="100%" controls></video> | ||
| (Video demonstrating the steps above) | ||
|
|
||
|
|
||
| ### Making it Multiplayer | ||
|
|
||
| At this point, we've got a Final IK player controller that looks great, and a camera that follows our player. Now we'll use Normcore to make it work in multiplayer. | ||
|
|
||
| (TODO: Do we build the RealtimeTransformManager component into Normcore or does this exist in RealtimeView?) | ||
|
|
||
| Blocked on the above TODO, will write the rest once we know how this manifests in Normcore. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.