Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Physics Based Character Controller

Discussion in 'Assets and Asset Store' started by nappin_zz, Jan 26, 2022.

  1. nappin_zz

    nappin_zz

    Joined:
    Nov 15, 2017
    Posts:
    22


    https://assetstore.unity.com/packages/tools/physics/physics-based-character-controller-203438

    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
     
    Last edited: Jan 27, 2022
    ml785 and Arkade like this.
  2. GrooGadgets

    GrooGadgets

    Joined:
    Apr 2, 2009
    Posts:
    67
    Hey,

    Does this asset support root motion?
     
  3. nappin_zz

    nappin_zz

    Joined:
    Nov 15, 2017
    Posts:
    22
    Hi, nope at the moment it doesn't. We are working on an update to include root motion as well
     
  4. GrooGadgets

    GrooGadgets

    Joined:
    Apr 2, 2009
    Posts:
    67
    Thanks for the reply, can you tell me when you expect the update to be ready?
     
  5. nappin_zz

    nappin_zz

    Joined:
    Nov 15, 2017
    Posts:
    22
    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!
     
    Last edited: Oct 27, 2022
  6. esgugel

    esgugel

    Joined:
    Jan 10, 2020
    Posts:
    1
    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)



    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.SceneManagement;
    5. using UnityEngine.AI;
    6.  
    7. public class NavMeshGenerator : MonoBehaviour
    8. {
    9.     public NavMeshSurface surface;
    10.  
    11.     void Start()
    12.     {
    13.         surface.BuildNavMesh();
    14.     }
    15.  
    16.     // Update is called once per frame
    17.     void Update()
    18.     {
    19.      
    20.  
    21.        // UpdateNAvmesh();
    22.     }
    23.  
    24.     public void UpdateNAvmesh()
    25.     {
    26.      
    27.     }
    28. }
    29.  
     

    Attached Files:

  7. nappin_zz

    nappin_zz

    Joined:
    Nov 15, 2017
    Posts:
    22
    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?
     
  8. theflorist614

    theflorist614

    Joined:
    Jul 2, 2022
    Posts:
    5
    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?
     
  9. nappin_zz

    nappin_zz

    Joined:
    Nov 15, 2017
    Posts:
    22
    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!
     
  10. Migaroez

    Migaroez

    Joined:
    Jun 16, 2014
    Posts:
    2
    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
     
    Last edited: Sep 19, 2022
  11. nappin_zz

    nappin_zz

    Joined:
    Nov 15, 2017
    Posts:
    22
    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!
     
    Dervishes likes this.
  12. macube

    macube

    Joined:
    Jul 16, 2017
    Posts:
    34
    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?
     
  13. Gardan

    Gardan

    Joined:
    Jul 5, 2012
    Posts:
    3
    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.

    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.

    Code (CSharp):
    1. if (transform.position.y < lastCharacterYPosition){
    2.     Debug.Log("going down");
    3.     canSlideMultiplierCurve = 3.0f;
    4. }
    5. else if (transform.position.y > lastCharacterYPosition){
    6.     Debug.Log("going up");
    7.     canSlideMultiplierCurve = -1.0f;
    8. }
    9.  
    10. 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.
     
    Last edited: Nov 17, 2022
  14. GrooGadgets

    GrooGadgets

    Joined:
    Apr 2, 2009
    Posts:
    67
    Hey @nappin_zz any word on root motion support?
     
  15. nappin_zz

    nappin_zz

    Joined:
    Nov 15, 2017
    Posts:
    22
    Hey @Gardan! Awesome thank you for the kind words let me know if you encounter other issues!
     
  16. nappin_zz

    nappin_zz

    Joined:
    Nov 15, 2017
    Posts:
    22
    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
     
  17. Psycho-Designs

    Psycho-Designs

    Joined:
    Oct 9, 2013
    Posts:
    14
    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)?
     
  18. Alima-Studios

    Alima-Studios

    Joined:
    Nov 12, 2014
    Posts:
    77
    Hi , speed of fall is damped when jumping
     
  19. blunzn

    blunzn

    Joined:
    Jan 14, 2015
    Posts:
    14
    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!
     
  20. Yardood

    Yardood

    Joined:
    Mar 29, 2015
    Posts:
    7
    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!
     
  21. Alima-Studios

    Alima-Studios

    Joined:
    Nov 12, 2014
    Posts:
    77

    not completly , I had to change some code , rotations are being setted directly in transform , this is not correct , must be using rigidbody
     
  22. AmazingRuss

    AmazingRuss

    Joined:
    May 25, 2008
    Posts:
    906
    Hi;

    I am having trouble figuring out how to make a character slide down a wall. If you jump at a wall while moving toward it, you will stick there until you move back. If you just let go of the keys, it slowly slides down the wall.

    I have set wall friction to 0.01.

    How can I make him slide down even if the forward key is held?
     
  23. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    189
    Hi, How to move character with other character's body part?
    And furthermore, climb on other character's body

    https://youtube.com/shorts/Grxqx5imf9g?feature=share
    In this video I tried to put moving platform (which taken directly from the demo scene. but does not move, just be child of the Chest monster's head bone)
    The player character can only inherit rotation in one direction, why is that?

    I want to make game where character can climb on other.

    Wishlist for a feature that match behaviour of moving platform, but just for collider on character's body.
    This way we can climb huge beast, that will be lot of fun.