Physics Based Character Controller

What is it?

Physics Based Character Controller is a powerful yet simple character controller based on the unity physics system. The player can easily interact with the physical environment, move and push objects, slide on surfaces, climb, wall jump and so on…

How do I use it?

Simple: install the package, setup a camera (the package uses cinemachine but can work with custom cameras) and the input reader and you are ready to go! The package accommodates the user who wants a simple plug and play solution and also developers who want to add their own modifications on top of the existing code.

What’s included?

The package contains:

  • Player model and multiple obstacle meshes
  • Prefab folder with all the “core” components
  • A sample scene that guides the user and allows them to experiment with the character controller and find the best parameters combination for their needs

The package main features are:

  • Basic character movement in third and first person
  • Player can move the character and rotate the camera
  • Player can perform jump, long jumps, wall climb, wall slide, crouch, climb and sprint
  • Camera solution to avoid clipping with the objects in the scene
  • Capsule based collision and simple interpolated movements
  • Allows the player to walk on rubble and irregular terrain
  • Allows the player to walk on smooth terrain with changing normals
  • Allows the player to move up a slope within a certain angle limit
  • Ground snapping so the player can stick to surfaces and slopes
  • Allows the player to move on steps (within a certain height set by the player)
  • Supports rigidbody interaction and allows the player to move and collide with rigidbodies
  • Supports and ignores specific layers
  • Contains prefab that simulate viscosity
  • Contrains speedup and slowdown platforms
  • Contains bounce platforms
  • Contains moving platforms
  • Contains rotating platforms that keep the player rotation locked

If you have any questions, suggestions or feedback, please feel free to contact me at nappin.1bit@gmail.com

2 Likes

Hey,

Does this asset support root motion?

Hi, nope at the moment it doesn’t. We are working on an update to include root motion as well

Thanks for the reply, can you tell me when you expect the update to be ready?

I’ve got no ETA at the moment as more important asset updates are taking priority. When I’ll have an idea of the timeframe I’ll of course update you!

RuntimeNavMeshBuilder: Source mesh eyes does not allow read access. This will work in playmode in the editor but not in player
UnityEngine.AI.NavMeshSurface:BuildNavMesh()
NavMeshGenerator:Start() (at Assets/MyAssets/Scripts/NavMeshGenerator.cs:13)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.AI;

public class NavMeshGenerator : MonoBehaviour
{
    public NavMeshSurface surface;

    void Start()
    {
        surface.BuildNavMesh();
    }

    // Update is called once per frame
    void Update()
    {
     

       // UpdateNAvmesh();
    }

    public void UpdateNAvmesh()
    {
      
    }
}


8308038–1089903–NavMeshSurface.cs (16.1 KB)

Hi! As far as I can tell the code you are showing is about the navmeshes and doesn’t have to do with the eyes mesh. The code is also not from the asset. What’s the issue specifically?

Hello, this asset is pretty much everything I need. However I am stumped on implementing a simple climbing mechanic similar to what you’d find in Breath of the Wild. Curious to know if anyone has any idea how you’d include something like that?

Hi, if you intend to implement a climb mechanic I suggest to use the “Ladder” script and mute the CharacterManager script when on a wall or tweak its gravity / drag values. I’m of course available if you need help with custom code!

Am I missing something or is the camera prefab shown in the documentation not included in the current release?

Update
There is indeed no prefab, but the object does exist in the sample scene which is in the top folder

Hi Migaroez! The asset works with cinemachine but supports all kinds of custom camera solutions. In the example scene I’ve setup a cinemachine that can indeed be copied in your own controller but also you can create another cinemachine camera solution and plug it in the controller.

If enough people ask for it, I’ll create a few cinemachine camera prefabs for those that want to use this setup. Tnx for the feedback!

1 Like

Hey,
i’m tested the webgl demo from the asset and i noticed one thing: if you stand directly in front of a wall and press the jump button, the jump does not work. A bug?

Hi, I’ve purchased the asset a few months ago, but only got the chance to use it recently. Loving it so far!

Edit: I had a question regarding slopes, but it seems I didn’t notice I just had to check the Lock on slope box to get the result I wanted.

solved

What I’m trying to achieve is to have the character slow down when going up a slide, and speed up when going down.
I believe I have to tweak canSlideMultiplierCurve, and I got a moderate success in doing so, but I do have jittery movement, as both negative and positive values are applied during update.

if (transform.position.y < lastCharacterYPosition){
    Debug.Log("going down");
    canSlideMultiplierCurve = 3.0f;
}
else if (transform.position.y > lastCharacterYPosition){
    Debug.Log("going up");
    canSlideMultiplierCurve = -1.0f;
}

lastCharacterYPosition = transform.position.y;

I’m not really sure if there is a proper and easy way to determine if the character is going up or down, as
currentSurfaceAngle is always positive.

Hey @nappin_zz any word on root motion support?

Hey @Gardan ! Awesome thank you for the kind words let me know if you encounter other issues!

Hey @GrooGadgets , not yet other updated are taking priority as of now. When we work on it I’ll be sure to ping you! Tnx

Hi, Would this character controller be able to walk around a dynamic RigidBody platform? I saw in the documentation that it works but I’d have to freeze rotation and have the RigidBody controlled by the script. Would it be possible to have it work with a RigidBody that’s driven by physics (Like Wheel Colliders)?

Hi , speed of fall is damped when jumping

hi, is this controlling a dynamic rigid body, so that physical interactions with other dynamic objects of different weights creates physically plausible results? Ie that lighter objects can be pushed more easily than heavier objects, and the player itself can be pushed by other moving entities? thanks!

Hey, is there any easy way to implement a custom gravity code I have for this player? i’m having a walkable planets with custom directions to the gravity type of project.

Thanks!