Search Unity

[Released] Kinematic Character Controller

Discussion in 'Assets and Asset Store' started by PhilSA, Sep 29, 2017.

  1. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    29
    can i make character controller have weight. so when character land on a "seesaw", the seesaw will be affected by this character controller's weight
     
    andreiagmu likes this.
  2. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    You can do this with AddForceAtPosition() at the ground hit point. Add a force corresponding to whatever mass you want the character to have
    https://docs.unity3d.com/ScriptReference/Rigidbody.AddForceAtPosition.html
     
    andreiagmu likes this.
  3. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Just to be clear, is this the approach where the object following the spline and the PhysicsMover object are two completely separate objects with no parenting?
     
  4. Vincent454

    Vincent454

    Joined:
    Oct 26, 2014
    Posts:
    167
    Yes, I tried both approaches, I am going to write my own spline solution I think, so I have more control over it. If that does not work either, I'll report back!
     
  5. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,054
    hey again!

    First off, the controller has been solving a few issues I was having in regards to jumping and falling along walls! So: thumbs up! :)

    I have a little question. Not sure if it's the intended behavior or not. In the main test scene, there are some blue square moving platforms (by the blue boat), one of them is also spinning. When I land on it I move along with it however I'm not being spun around with it. I would expect that when I'm on a rotating object my character controller should rotate as well.

    Is there any reason why it's like this? is this the intended behavior? Is there any way this can be fixed? Could that be related to slope alignment in any way?

    Thanks, looking forward to your answer.
     
    andreiagmu likes this.
  6. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    This is a question of what is being done in your CC's UpdateRotation() method

    I think by default the character's "orientation method" is set to "Towards camera", which results in this:
    https://i.gyazo.com/b93904e2888551e28049c1512958425f.mp4
    ...because even if it's getting turned by the platform, it's still always reorienting to face the camera

    If you set it to "Towards movement" instead (or if you delete all the code in UpdateRotation()), you'll get this:
    https://i.gyazo.com/3bcca9f701b427e4384dc5213766a77b.mp4

    If, however, you need the "towards camera" behaviour combined with the platform making your character rotate, what you're actually looking for is making the platform rotate the camera, so that the character will in turn face towards the rotated camera direction. You could modify the update code of ExampleCharacterCamera so that if its followed character is on a moving platform, it rotates every frame by PhysiceMover.RotationDeltaFromInterpolation on top of its original rotation code
     
    andreiagmu and PROTOFACTOR_Inc like this.
  7. PROTOFACTOR_Inc

    PROTOFACTOR_Inc

    Joined:
    Nov 15, 2009
    Posts:
    4,054
    Thank you for the detailed explanation. Will give it a go.
     
  8. Fabraz

    Fabraz

    Joined:
    Sep 15, 2014
    Posts:
    66
    Hiya!
    I'm using the plugin for a 3d platformer and its working like a charm! I was wondering if there's a way to combine the PhysicsMover functionality with animation-based movement to simplify some scene/mechanic setup. Setting the position to the current position/rotation freezes the motion, so its bypassing the animated values somehow. Removing the PhysicsMover and setting the animator update mode to "animate physics" at least has the controller pick up the platforms motion, but it doesn't apply any of the rotation. Is there a setup that would allow using animations like this, or does all the PhysicsMover motion need to be coded?
     
  9. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    The approach i suggest for this is to have an empty transform doing an animation, and then have your PhysicsMover be a totally separate object that copies the animated transform's pos+rot when it's time to set them

    You also have the walkthrough section on moving platforms which shows a different but more complicated approach to physicsmovers + animation (requires you to manually sample the animation in code)
     
  10. Fabraz

    Fabraz

    Joined:
    Sep 15, 2014
    Posts:
    66
    Ah, the first one is a pretty simple work around! I'll take a look at the walkthrough example, but the former sounds like it should work for my purposes, thanks!
     
  11. Dnawrkshp

    Dnawrkshp

    Joined:
    Jan 19, 2014
    Posts:
    4
    Hi Phil! Happy Holidays!

    I'm implementing the networking code for my game and I remember that you used to have an example project with rollback and prediction. Could you share the project? I don't mind if it doesn't work, I just want to dissect how you manipulated KinematicCharacterSystem.Simulate() for proper rollback.


    Thanks!
     
  12. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Here's a zip of the old walkthrough section on networking along with the walkthrough pdf that explains everything

    Keep in mind this was all just an attempt to demonstrate networking, so the code of the demo isn't really usable
     

    Attached Files:

  13. id55503

    id55503

    Joined:
    Dec 23, 2017
    Posts:
    4
    Hi, I make a flattening monster but KinematicCharacterMotor used capsule collider it can't make the flattening shape. How can I use a box collider instead capsule?
     
  14. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    KCC can only use an upright capsule, like Unity's CharacterController component

    But nothing prevents you from making the mesh flat independantly from the collider
     
  15. FcsVorfeed

    FcsVorfeed

    Joined:
    Aug 15, 2014
    Posts:
    50
    hi, i have a preblem, how can i get the distance between character and grounded?
    Can KCC provide a simple API direct return the distance?
    I use the transform position but it really hard to check all the collider layer tag and setting
     
  16. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Hi, is it possible to make KCC work with highly tessellated terrain? Thanks :)
     
  17. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Yes, the webGL demo has examples of it running on terrain
     
  18. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    If you're not already grounded, there's no built-in way to access that info because it would involve either making extra capsule casts, or making the ground probing casts super long which would result in performance loss

    So what I suggest is to call your own motor.CharacterCollisionsSweep downwards that detects ground distance. As an optimisation, you can choose to only call it when motor.GroundingStatus.FoundAnyGround is false. When the GroundingStatus does find ground, the distance to ground is Vector3.Project(motor.GroundingStatus.GroundPoint - motor.TransientPosition, motor.CharacterUp).magnitude
     
    andreiagmu and FcsVorfeed like this.
  19. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    I mean actual tessellation. We are using MicroSplat for example. And already own KCC. But when I tried putting the example KCC on a tessellated terrain, he fell through/ignored the tessellated part of the terrain - and kept using the normal terrain collider. And I found no mention of tessellation in KCC docs, nor in this thread.

    I understand tessellation is on the GPU side and is complicated to use for physics. But I also saw this, which gives me a little hope. What do you think? Is it possible?

    Also, HAPPY NEW YEAR everyone :D
     
  20. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    As long as there is a collider (generated at runtime by tessellation or not), then KCC should collide with it

    However, I don't know exactly how MicroSplat's tesselated collisions work, but the author seems to say at 3:09 that the package comes with a certain API for tessellated physics which the users must use in order to handle their particular use cases, and that it's not a solution that just works automatically. So it looks like in the case of MicroSplat, it doesn't actually generate a real collider, but rather just gives you a way to sample the height of where the ray hit would be at that position.

    The author also says in the video at around 3:30 that for a character, he'd recommend just sampling the collisions for each foot. What that means is that the character controller could just collide with the regular untessellated terrain mesh, but the IK would place the character's animated mesh on the exact surface of the tessellated terrain
     
  21. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    upload_2019-12-31_21-28-37.png

    Unfortunately it's not just about the feet, otherwise I would do just that :D

    Generating a collider sounds nice in theory, but the geometry is too complex with the tessellation in place. Yep, I could possibly generate somewhat lower-poly version of the collider, but that would be quite complex to implement and handle various edge cases at the same time.

    Also the video, unfortunately, applies to another product. Similar product from the same author, but not the same product. I'm waiting for a reply if I could get somewhat similar API at least for raycasts. I sent the video like a proof of concept - that it should be possible to perform at least raycasts against the tessellated data.

    Come to think of it, that would not be enough for KCC though. I think... it's not using just raycasts, right? But some spherecasts etc. as well?

    I would love to simply ditch the tessellation to simplify my life, but our graphics designer would have my head :D He loves it... the detail he can add.
     
  22. ge01f

    ge01f

    Joined:
    Nov 28, 2014
    Posts:
    121
    Hey Phil,

    How do you pause the KCC now? I saw in a previous thread you said use KinematicCharacterMotor.HandlePhysics(false, false)

    However this doesnt seem to exist anymore. What is the current way to pause things? When I just KCC or KCC.Motor to enabled = false, it works, except I go through the floor if Im jumping. And have to jump again to get un-embedded.

    I'd like to totally pause everything. The previous request was also have to move things once paused, which I will also need for teleporting. So will the pause also allow updating pos/rot, like the previous answer you had?

    Thanks!
     
  23. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    I would've suggested just Motor.enabled = false. But alternatively you can try all 3 of these simultaneously and see if it solves the issue you get when disabling the motor:
    • motor.SetCapsuleCollisionsActivation(false)
    • motor.SetMovementCollisionsSolvingActivation(false)
    • motor.SetGroundSolvingActivation(false)

    As for how to move things while paused, simply go with Motor.SetPosition(pos, rot, true)
     
    andreiagmu likes this.
  24. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    It uses capsulecasts, yeah. The only way I'd see this working is if you'd generate a really small meshCollider every frame only in the area underneath the character in a certain radius.... we'd have to see how expensive that would be
     
  25. DanZ91

    DanZ91

    Joined:
    Sep 29, 2016
    Posts:
    6
    Hello. Will be there stutter effect if i will using your CC with camera which moves in update()?
    Character moving in update or fixedUpdate?
     
  26. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    It won't stutter. In the example character controller from this package, the camera moves on update

    The CC moves on fixedupdate, but it is interpolated on update
     
    Last edited: Jan 11, 2020
  27. Lex

    Lex

    Joined:
    Dec 2, 2009
    Posts:
    43
    Even if you're able to make the character controller not being fully "kinematic", please consider adding an option to make if fully kinematic. I'm not sure if that makes sense, but I don't think I want my character reacting to physics that much without full control over what's happening.
     
  28. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Yup, that's the plan
     
    Lex likes this.
  29. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Has anyone ever have the ExampleCharacterController (from the main example scene) fall through a terrain?
    It just happened to me, but only once and I'm not able to reproduce it. Don't remember the exact place on the huge terrain where I fell through :D
    Unity 2019.3.0f1
    KCC 3.2.1
     
  30. michaelmcmurdy_amtote

    michaelmcmurdy_amtote

    Joined:
    Apr 3, 2019
    Posts:
    5
    Are there any known issues with this in unity 2019.2.x(17)?
     
    Last edited: Jan 14, 2020
  31. JRRReynolds

    JRRReynolds

    Joined:
    Oct 29, 2014
    Posts:
    192
    michaelmcmurdy_amtote likes this.
  32. michaelmcmurdy_amtote

    michaelmcmurdy_amtote

    Joined:
    Apr 3, 2019
    Posts:
    5
    Cool, thanks!
     
  33. frostymm

    frostymm

    Joined:
    Jun 21, 2013
    Posts:
    34
    Quick question since I can't seem to wrap my head around it. The simulate method which handles updateVelocity and all that uses Time.deltaTime but it runs in FixedUpdate(). Is there a reason it doesn't use Time.fixedDeltaTime?
     
  34. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    259
    Time.deltaTime returns fixedDeltaTime when used in FixedUpdate. So, there's no reason to use fixedDeltaTime explicitly, and code is more portable if you don't. From the Time.fixedDeltaTime documentation:
     
    Last edited: Jan 18, 2020
    Vincent454 likes this.
  35. frostymm

    frostymm

    Joined:
    Jun 21, 2013
    Posts:
    34
    That is not something I knew! Thanks a bunch!
     
  36. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    @PhilSA
    I'm wanting to setup my simulation so that it will independently Tick regardless of frame rate for networking purposes. I figure that if simply Ticking inside of Update(), then different hardware will Tick faster or slower than another leading to trouble keeping in sync. The other reason is that I want the ability to "speed up" and "slow down" the simulation of the players as described in the Overwatch netocde GDC talk.

    Here is what I'm currently attempting for my "Simulation Update Loop":
    Code (CSharp):
    1.  
    2. void Start()
    3. {
    4.     ManualTicking();
    5. }
    6.  
    7. async void ManualTicking()
    8. {
    9.      while (true)
    10.      {
    11.            await Task.Delay(TimeSpan.FromSeconds(TickRate));
    12.            Tick();
    13.       }
    14. }
    15.  
    16. void Tick()
    17. {
    18.      MasterTick++;
    19.  
    20.      KinematicCharacterSystem.PreSimulationInterpolationUpdate(TickRate);
    21.  
    22.      // Event is sent that listeners (players) listen to and call Simulate on their KCC object
    23.      EventManager.TriggerEvent(GameConstants.SimulationTick, MasterTick);
    24.  
    25.      KinematicCharacterSystem.PostSimulationInterpolationUpdate(TickRate);
    26. }
    27.  
    A few questions:
    - Is this a decent way to have a frame rate independent Tick loop? Or what would you suggest? Looking at your old Network Code it looks like you simply use FixedUpdate() to Tick(), but did you have some way to Speed Up / Slow Down the simulation with this setup?

    - Because this code no longer executes inside the standard Update() loop, I'm not sure what value I'm supposed to be passing to Pre and Post SimulationInterpolationUpdate(). Do I want to pass my Tick Rate? Or do I still pass Time.deltaTime?
     
    Last edited: Jan 19, 2020
  37. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Yup that sounds good. The networking example fast forwarded by manually calling Simulate until the real present tick was reached (all in a single frame), but didn't deal with accelerating the "time scale" if I remember correctly

    You should pass the true amount of time that a tick represents. So with a tick rate of 10, you'd pass 1/10. With a tick rate of 60, you'd pass 1/60
     
    rxmarccall likes this.
  38. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    227
    I just started using your character controller and I am a noob at this. So I followed the walk through up to double jumping with my own character and animation. After landing and sliding a tiny bit from a double jump, it takes a 1-2 seconds to exit jump animation to idle animation. I dont have any exit time. How do I fix that? Should I upload my project?

    My animation handler code:
    Code (CSharp):
    1.         [Header("Animation Parameters")]
    2.         public Animator MyAnimator;
    3.         public float ForwardAxisSharpness = 10;
    4.         public float VerticalAxisSharpness = 5;
    5.         private float forwardVelocity;
    6.         private float verticalVelocity;
    7.         private float desiredForwardSpeed;
    8.         private float desiredVerticalSpeed;
    9.  
    10.         private void Update()
    11.         {
    12.             AnimationHandler();
    13.         }
    14.  
    15.         public void AnimationHandler()
    16.         {
    17.             forwardVelocity = Mathf.Lerp(forwardVelocity, desiredForwardSpeed, 1f - Mathf.Exp(-ForwardAxisSharpness * Time.deltaTime));
    18.  
    19.             MyAnimator.SetFloat("ForwardSpeed", forwardVelocity);
    20.             MyAnimator.SetBool("grounded", Motor.GroundingStatus.IsStableOnGround);
    21.  
    22.             MyAnimator.SetFloat("VerticalSpeed", desiredVerticalSpeed);
    23.         }
    24.  
    25.  public void SetInputs(ref PlayerCharacterInputs inputs)
    26.         {
    27.             // Clamp input
    28.             Vector3 moveInputVector = Vector3.ClampMagnitude(new Vector3(inputs.MoveAxisRight, 0f, inputs.MoveAxisForward), 1f);
    29.  
    30.             // Calculate camera direction and rotation on the character plane
    31.             Vector3 cameraPlanarDirection = Vector3.ProjectOnPlane(inputs.CameraRotation * Vector3.forward, Motor.CharacterUp).normalized;
    32.             if (cameraPlanarDirection.sqrMagnitude == 0f)
    33.             {
    34.                 cameraPlanarDirection = Vector3.ProjectOnPlane(inputs.CameraRotation * Vector3.up, Motor.CharacterUp).normalized;
    35.             }
    36.             Quaternion cameraPlanarRotation = Quaternion.LookRotation(cameraPlanarDirection, Motor.CharacterUp);
    37.  
    38.             // Move and look inputs
    39.             _moveInputVector = cameraPlanarRotation * moveInputVector;
    40.             _lookInputVector = cameraPlanarDirection;
    41.  
    42.             // Jumping input
    43.             if (inputs.JumpDown)
    44.             {
    45.                 _timeSinceJumpRequested = 0f;
    46.                 _jumpRequested = true;
    47.             }
    48.  
    49.             // Animation
    50.             desiredForwardSpeed = moveInputVector.magnitude * MaxStableMoveSpeed;
    51.         }
    52.  
    53. public void SetInputs(ref PlayerCharacterInputs inputs)
    54.         {
    55.             // Clamp input
    56.             Vector3 moveInputVector = Vector3.ClampMagnitude(new Vector3(inputs.MoveAxisRight, 0f, inputs.MoveAxisForward), 1f);
    57.  
    58.             // Calculate camera direction and rotation on the character plane
    59.             Vector3 cameraPlanarDirection = Vector3.ProjectOnPlane(inputs.CameraRotation * Vector3.forward, Motor.CharacterUp).normalized;
    60.             if (cameraPlanarDirection.sqrMagnitude == 0f)
    61.             {
    62.                 cameraPlanarDirection = Vector3.ProjectOnPlane(inputs.CameraRotation * Vector3.up, Motor.CharacterUp).normalized;
    63.             }
    64.             Quaternion cameraPlanarRotation = Quaternion.LookRotation(cameraPlanarDirection, Motor.CharacterUp);
    65.  
    66.             // Move and look inputs
    67.             _moveInputVector = cameraPlanarRotation * moveInputVector;
    68.             _lookInputVector = cameraPlanarDirection;
    69.  
    70.             // Jumping input
    71.             if (inputs.JumpDown)
    72.             {
    73.                 _timeSinceJumpRequested = 0f;
    74.                 _jumpRequested = true;
    75.             }
    76.  
    77.             // Animation
    78.             desiredForwardSpeed = moveInputVector.magnitude * MaxStableMoveSpeed;
    79.         }
    80.  
     
    Last edited: Jan 20, 2020
  39. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    227
    I noticed a lot camera clipping into the player when you face the wall or when you standing under a moving platform or crouching in tight spaces in the walkthrough examples. Is there a way to minimize that?
     
  40. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    259
    Any camera controllers included in KCC are for minimal example purposes only, since KCC isn't a camera plugin. Look instead into Cinemachine, which is freely available in the package manager and has camera collision functionality. If you're looking for a third-person camera controller, try its Free Look Camera component, of which an instance can be created in the editor and configured very quickly.
     
    Last edited: Jan 20, 2020
  41. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    In FPS I suppose it's best to calculate near camera plane and place the camera inside the player capsule collider just enough to make sure it never clips through the walls even for players with obscure aspect ratios?
     
  42. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    259
    For an FPS, I would expect the camera to be centered (on the x and z axis) rather than offset forward at all.
     
  43. Gooren

    Gooren

    Joined:
    Nov 20, 2015
    Posts:
    332
    Yes, you are right, thanks for correcting me. Offsetting the camera on Z axis would look terrible when rotating around Y axis as the player looks around :D
     
  44. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    227
    Does the camera controller script work with cinemachine together? I still couldnt figure out my first problem. Where is the drag coming from. I set drag to 0 and i am still slipping when i land from a jump.

    is there a manual for scripting the controller? I want to get hit.normal on slope angle to i can slide on steep slopes.
     
    Last edited: Jan 20, 2020
  45. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    259
    Cinemachine's FreeLook component can function without supporting scripts. But, you can move a Cinemachine virtual camera just like any other transform if you want to script your own controller.

    Drag is the opposite of what you're describing. For reference, I use a drag of 0.1f. If you're consistently sliding only on landing, I'm not sure what could cause that. I've noticed that my controller occasionally slides a bit on landing as well, and I haven't found the cause in my case either. I'm interested in if anyone else has noticed this and found a fix.

    The Kinematic Character Controller package comes with an API reference and user guide. The playground example character controller slides on steep slopes. You're sliding if grounded but not stable (Motor.GroundingStatus.FoundAnyGround && !Motor.GroundingStatus.IsStableOnGround). The normal is Motor.GroundingStatus.GroundNormal.
     
  46. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    227
    thank, your right, there is sliding. Any ideas how get sliding speed or check when the character is sliding?
     
    Last edited: Jan 21, 2020
  47. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    227

    good news, I found out where the drag thingy coming from. Theres no setting you can make to adjust it. Disappointing... You have to go inside your kcm script and add a variable or something. Its handle under HandleVelocityProjection()

    Code (CSharp):
    1.      /// <summary>
    2.         /// Allows you to override the way velocity is projected on an obstruction
    3.         /// </summary>
    4.         public virtual void HandleVelocityProjection(ref Vector3 velocity, Vector3 obstructionNormal, bool stableOnHit)
    5.         {
    6.             if (GroundingStatus.IsStableOnGround && !MustUnground())
    7.             {
    8.                 // On stable slopes, simply reorient the movement without any loss
    9.                 if (stableOnHit)
    10.                 {
    11.                     velocity = GetDirectionTangentToSurface(velocity, obstructionNormal) * velocity.magnitude;
    12.                 }
    13.                 // On blocking hits, project the movement on the obstruction while following the grounding plane
    14.                 else
    15.                 {
    16.                     Vector3 obstructionRightAlongGround = Vector3.Cross(obstructionNormal, GroundingStatus.GroundNormal).normalized;
    17.                     Vector3 obstructionUpAlongGround = Vector3.Cross(obstructionRightAlongGround, obstructionNormal).normalized;
    18.                     velocity = GetDirectionTangentToSurface(velocity, obstructionUpAlongGround) * velocity.magnitude;
    19.                     velocity = Vector3.ProjectOnPlane(velocity, obstructionNormal);
    20.                 }
    21.             }
    22.             else
    23.             {
    24.                 if (stableOnHit)
    25.                 {
    26.                     // Handle stable landing
    27.                     velocity = Vector3.ProjectOnPlane(velocity, CharacterUp);
    28.                     velocity = GetDirectionTangentToSurface(velocity, obstructionNormal) * velocity.magnitude;
    29.                 }
    30.                 // Handle generic obstruction
    31.                 else
    32.                 {
    33.                     velocity = Vector3.ProjectOnPlane(velocity, obstructionNormal);
    34.                 }
    35.             }
    36.         }
    You can simply multiply by 0.5f to reduce the drag by half. Deleting will feel weird.
    // Handle stable landing
    velocity = Vector3.ProjectOnPlane(velocity, CharacterUp) * 0.5f;
    velocity = GetDirectionTangentToSurface(velocity, obstructionNormal) * velocity.magnitude * 0.5f;

    And the sliding is kinda handle underneath "Handle generic obstruction" I dont know what that means
     
    Last edited: Jan 21, 2020
  48. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    227
    I think I found a bug. If you have double jump on and not allow jump while sliding, you can still jump from sliding. I think its because you're not resetting double jump when you jump on a slippery slope. Same problem in the walkthrough.
     
    Last edited: Jan 21, 2020
  49. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    227
    I want to say its a good character controller, I am loving it, and i am looking forward to make further improvements and adjustments to this character controller. I learn so much already even though i am kinda a beginner. I seen people game dev logs using this controller and i am amazed how much further potential this controller has to offer. To the creator; please dont give up.
     
  50. Pixitales

    Pixitales

    Joined:
    Oct 24, 2018
    Posts:
    227
    I fixed all the bugs above. How do i check if the player sliding is true on a steep slope and check sliding is false after the player stop sliding?