[1.0] Custom 3rd person physically based character controller


Hello everybody!

Since my game uses LOTS of physics, i recently managed to create a custom character controller for PlyGame that uses rigid body and capsule collider instead of Unity’s “CharacterController”. The normal character controller works fine for games that don’t need physics, but i personally found it too limiting.

Today i spent some hours doing a mixture of reading unity documentation, googling up useful information, picking up code segments from here and there and… with tons of trial and error, my custom character controller was born. The code is currently quite rough and i will make sure to refine it and update it in the close future.

Feel free to ask questions, report bugs or help me improve the script in this thread. I am no super-programmer-guru so i’m open for all improvement suggestions.

Before reporting any bugs, make sure of the following:

  1. Remove “CharacterController” and plyGame top down/third person character controllers scripts that are currently attached to your player. You can keep whatever camera script you are using.

  2. Your character has a rigid body and a capsule collider attached. You can use the same radius/height/etc settings on the capsule collider as your character originally had on the “CharacterController”.

  3. Your “Floor” layer is set on Layer number 8. (It will be by default, if you have not changed it yourself) Also make sure your terrain uses the “Floor” layer.

  4. Don’t use any crazy rigid body settings. I currently use this, and strongly recommend that you do too unless you know what you are doing and change the controller accordingly:


How to use other asset with plyGame, also, harvesting?
How to 'throw' monsters away?
(Joe) #2

Imported with no warnings but I can’t get the player to move. Removed plygame controller and character controller and followed your guide lines.


That’s weird. I tried creating a new unity project from scratch now to see if anything was not working. Everything seems to work fine for me.

Something i forgot to mention is that your terrain/whatever your player walks on needs to be set as “Floor” on its layer, otherwise jumping won’t work. But that does not seem to be the problem in this case…

Is your capsule collider using the same radius/height as the character controller was using? Can you still rotate the character or jump?

Do you have anything else in your game that could affect the movement (custom inputs, movement blocks, scripts) ?

EDIT: I’ve updated the guidelines. Should be more clear now.

(Joe) #4

Had to reset my Input manager to try it. Well it works without any warnings so that’s a strong start :grin:
My question to Leslie is there a way there can be a kind of generic /vanilla character controller script that plygame would recognize and accept so I could create controls in playmaker with no interference. A script that would do everything the other plygame modules need but let me have total control over input/ movement of the character or physics character controller. If this is possible I will share my plygame controllers with the community.


I’m happy you figured it out!

When it comes to your question: Yes, there definitely is a vanilla controller/module - That’s how i managed to create this custom controller. Basic understanding of programming is required to make it work though, since you have to put some puzzle pieces together so to say.

You can read about how to create custom controllers for plyGame here: http://www.plyoung.com/docs/new-character-controller.html

Shortly put:

  • Handle the custom input/movement in the script itself.
  • Make your script derive from plyGame classes so that plyGame recognizes it, meaning that your player will be able to use plyGame skills, stats, factions, etc EVEN if you have custom movement/input logic.

For example, in my rigidbody script, i made it derive from PlayerBaseController.


I noticed that download link was broken so i reuploaded the current version to a new website.

I also want to give a heads-up that the next update of the controller is light years away ahead of this one when it comes to functionality and smoothness. Most issues are fixed and it really feels like a great controller now.

Patch 2.0 will include:

  • New custom camera controller and animation controller tailored for this character controller will be included.
  • Controller works more like a 3D single player RPG platformer now. Check out Dragon Age: Inquisition or Shadow of the Colossus for reference. I felt that the original 3rd person controller was too MMORPG-ish.

  • Weird gliding on higher slopes is now fixed.
  • Rewritten movement logic. Uses more advanced movement with new movement customization features.
  • Added “Realistic Jumping” feature that can be turned On/Off. When on, lets the physics engine decide the landing position.
  • Movement is now correctly handled in FixedUpdate(). Input and rotation is still handled in Update().
  • Much smoother and more responsive jumping now. Also fixed a bug where jumping reduced x- and z-velocity.
  • After all other fixes, rotation automatically works much better. No need to fix it anymore.
  • Added a feature to rotate the character art towards the characters velocity direction.
  • More will be included…

(Luka Andric) #7

Wow cant wait to see more :smiley: good work

(Michael Urvan) #8

@redikann here is a generic controller that will let you use playmaker or anything for all input. All it requires is a Character Controller on your player. This controller would replace your plygame “3rd person controller”, so you remove that one. Using a controller like this will cause a few things not to work in plygame, for instance the “move to interact feature” will not work without some more scripting added where I have some commented out lines below but most things still work, just no movement.

Create a C# script named PlyGamePlayerControllerFacade and add it to your project, then paste this code into the file then attach this script to your player, it just requires a CharacterController:

using UnityEngine;
using System.Collections;
using plyGame;
public class PlyGamePlayerControllerFacade : PlayerBaseController 
                CharacterController ctrl;
                void Awake() {
                    Player.Instance = this;
                    Player.Camera = Camera.main;
                    ctrl = GetComponent<CharacterController>();
                void Update() {
                public virtual bool RequestFaceDirection(Vector3 direction, float delayAfter)
                    //player.RotateTo(Quaternion.LookRotation(direction).eulerAngles, 0, delayAfter);
                    return false;
                public virtual bool RequestMoveTo(Vector3 position, bool useFasterMovement)
                    //player.MoveTo(position, 5, 0);
                    return false;
                public virtual bool Grounded()
                    return ctrl.isGrounded;
                public virtual Vector3 Velocity()
                    return ctrl.velocity;

(Joe) #9

Hey that’s awesome. I will create a physics driven player controller with playmaker and share it with the community. Not that I want to compete with Yokogeri, but I think it would be easier to trade ideas (since I code at a 2nd grade level) and guide anyone out there that are not at a certain level with Playmaker.


is this just for WASD movement or also for the top-down navmesh controller?


My controller will only support WASD movement similar to the original plyGame 3rd person character controller.



I pretty much managed to finish the controller, which works perfectly. The reason i have not posted it yet is cause i bumped into another problem: I want the controller to make my animations (8-directional with 90,135,180 etc degree turns) transition smooth and seamless, which the current controller does not support at the moment (and neither do the normal plyGame controls).

This requires me to rewrite a major part of the controller since i’ve decided that i will start using animation curves, root motion and a few of the new Unity 5 animation features such as state machine behaviours.

(Stephen Follett) #13

how well does this work with the legacy and mecanim animator? cause right now im having issues setting up the mecanim so that the blending of 1 animation to the next is smooth (but i also think thats due to the animation being in action blocks rather 1 whole animation slide)

this btw looks good and great job


This controller won’t support legacy animations at all, i simply don’t have the time to make the controller support it. The controller will be completly based on mecanim, which i’m sure will work out great!


Animations are taking on shape more and more!

(William Ianneci) #16

Hey, how close to the next release, great job, TY.


Now that i’ve chosen to rewrite major parts of the controller i’m guessing it will take me at least 2-3 weeks since i’m still quite new to advanced animation scripting with root motion, match targeting, IK, etc.

(Stephen Follett) #18

im still a new to mecanim lol

(Rare Ambar) #19

any updates on this controller?

(Zoey Bell) #20

ummm… the link is down… :confused: