Search Unity

Official Experimental Character Controller package now available (formerly known as "Rival")

Discussion in 'Entity Component System' started by philsa-unity, Mar 1, 2023.

  1. vzlomvl

    vzlomvl

    Joined:
    Jun 25, 2016
    Posts:
    43
    Hello @philsa-unity
    I have a question about Update_PreventGroundingFromFutureSlopeChange (Slope management | Character Controller | 1.0.0-exp.5 (unity3d.com)). Currently this logic is using raycast for future ground detection and it works fine in most cases but in some cases it can give false positive isMovingTowardsNoGrounding. For example if CharacterController is moving parallel to the crack in the floor it can lead to isGround false (Basic sample video attached)
    https://drive.google.com/file/d/1PmsmcVT6680NIakGLPS81F0onmdYllvX/view?usp=share_link
    Do I understand correctly that currently PreventGroundingFromFutureSlopeChange don't support such level geometry? Perhaps you have already thought about such a use case, and you had thoughts on how to prevent the issue (even if it requires additional performance cost).
    Thanks.
     
    Last edited: Apr 25, 2023
  2. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    This is a known area of improvement for the future, and that limitation is part of why this functionality is isolated into its own function (so it could be replaced with a custom alternative approach if necessary)

    The challenge is to find the right balance between fidelity and performance. A more reliable detection using shape casts and an evaluation of multiple hits would be possible, but would have a big performance impact. Adding this more expensive approach as an option will be something to be looked into for future updates
     
    vzlomvl likes this.
  3. ThynkTekStudio

    ThynkTekStudio

    Joined:
    Sep 4, 2021
    Posts:
    59
    hi, does anybody know how to make it work with terrains?


    ad prefer not to extract the terrain mesh just to be used as a representation used for collision

    thanks
     
  4. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
    Hello @philsa-unity,

    I recall that in previous versions of the Character Controller package, when it was known as Rival, you had provided examples of abilities such as Dashing and Flying. I was wondering if it would be possible to access those same samples in the new package as well.

    Moreover, I am interested in learning more about how to implement the dash ability. Would you be able to offer any guidance or tips on how to approach this feature? Thank you for your time.

    thanks!
     
  5. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    You can find example implementations of these in the Platformer sample. The sample's docs have pages on these that give a brief implementation overview: https://github.com/Unity-Technologi.../Samples/PlatformerSample/character.md#states

    (See "Flying" and "Dashing" under the "States" section)
     
    Opeth001 likes this.
  6. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    There's currently no support for converting Terrain to entities, so a mesh approach would be required at the moment
     
    ThynkTekStudio likes this.
  7. ThynkTekStudio

    ThynkTekStudio

    Joined:
    Sep 4, 2021
    Posts:
    59
    I've done what i said i don't want to do and honestly it yielded a very good result.
     
  8. brummer

    brummer

    Joined:
    Jul 3, 2013
    Posts:
    31
    To classic users of KCC; how does this compare to Phil's previous asset, kinematic character controller? What are the advantages and disadvantages?
     
  9. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    386
    Hi, just wondering if there's best practice for handling vehicles? At the moment on exiting the vehicle I've been mimicking the teleport script, and setting the character's LocalTransform position to the exit position followed by:

    Code (CSharp):
    1.  if (CharacterInterpolationLookup.HasComponent(ControlledCharacter))
    2. {
    3. CharacterInterpolation interpolation = CharacterInterpolationLookup[ControlledCharacter];
    4. interpolation.InterpolationFromTransform.rot = characterTranslation.Rotation;
    5. interpolation.InterpolationFromTransform.pos = characterTranslation.Position;
    6. interpolation.SkipNextInterpolation();
    7. CharacterInterpolationLookup[ControlledCharacter] = interpolation;
    8. }
    However if I add a Disabled component to the character entity on vehicle entry, and remove the Disabled component on exit using a commandbuffer after the above, I get NANs on the LocalTransform circa 1/5th of the time. Happy to just disengage input and hide the visual part, but also keen to hear if there's a better way to do this. Thanks!

    Edit: Still getting NANs even without disabled components, but less frequently. I think this started in the latest Character Controller version
     
    Last edited: May 3, 2023
  10. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    How to best ignore certain collision hits with the character controller (similar to ModifyBroadphasePairs of the physics samples).

    Is there a recommended way to modify the collisions (based on certain components etc.)?
     
  11. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    386
    Occurred to me that this isn't really enough to debug. If it's relevant, the entry trigger on the vehicles is on a dynamic body, so with the latest update, during setup, I'm calling:

    Code (CSharp):
    1. if (SystemAPI.HasSingleton<DisableCharacterDynamicPairs>())
    2. {
    3. var CharacterDynamicPairsSystemSingleton = SystemAPI.GetSingletonEntity<DisableCharacterDynamicPairs>();
    4. World.DefaultGameObjectInjectionWorld.EntityManager.DestroyEntity(CharacterDynamicPairsSystemSingleton);
    5. Debug.Log("Removing DisableCharacterDynamicPairs Singleton");
    6. }
    As per the docs. The Character collision response is set to 'Raise Trigger Events' so it's pretty close to before the update.

    This was the only way I could find to get the trigger data from the collision between dynamic vehicles and the player character. Once the player character is within the trigger volume, on 'enter' input, I remove an 'Active Player' component from the character and add the same component to the vehicle, via commandbuffer, which handles a few other things. This is when I had been adding a 'Disabled' component to the player character. On 'exit' input, I check a few conditions are met and then swap the 'Active Player' components again and remove the 'Disabled' component.

    I'm increasingly thinking the NaNs are to do with the DisableCharacterDynamicPairs workaround but haven't yet found a solution.
     
  12. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    The "CanCollideWithHit" callback of your character aspect can be used for this. See this section of the tutorial for an example:
    https://github.com/Unity-Technologi...ntation/Tutorial/tutorial-ignorecollisions.md
     
    Occuros likes this.
  13. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    I'm not seeing anything wrong with what you're doing at the moment, and I haven't been able to repro this by trying out adding/removing the Disabled component in some of the samples. But if you have a repro project to send via bug report, I could look into it

    A NaN position could be a consequence of a NaN velocity. I would most likely start by tracking down at what point of what frame this starts being NaN, and which calculation causes it to become NaN
     
    Karearea likes this.
  14. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    386
    After creating a repro project, I found one cause of the NaN bug was my origin reset system becoming confused by the vehicle triggering a reset before exit. Unsure why that's only emerged now, as there were some checks built in to ensure the player reset data stayed up to date.

    So I merged a fix back to the main project, but I'm still getting the bug (albeit less frequently). I haven't found a way to identify exactly where it's occurring, but it does seem related to the presence of other physics geometry in close proximity to the vehicle on exit, particularly mesh colliders. As if there's a momentary issue with extricating the body from surrounding collisions? This is happening even if I don't add/remove the Disabled component.

    Edit: I've been able to reproduce the bug in the repro project again, with the vehicle sitting on a mesh collider. I'll zip it up and log a bug report
     
    Last edited: May 9, 2023
  15. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    386
    Reported with CASE IN-40669. Thanks!
     
    philsa-unity likes this.
  16. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    I may have found the cause of the issue:
    • In VehicleSeatJob, a new "LocalTransform characterTranslation" is created with the default constructor. This initializes the Rotation to a (0,0,0,0) quaternion.
    • Then, characterTranslation.Position gets assigned to the worldspace exit position. So far so good
    • However, a bit later in the job, you get the character LocalTransform via lookup, set its position and rotation using the "characterTranslation" LocalTransform, and set back the component via lookup
    That last point is where the issue is, I believe. When setting the rotation to "characterTranslation.Rotation", you are setting the rotation to an invalid quaternion (0,0,0,0) because that quaternion was never assigned a valid value. If you try to assign rotation with "tch.Rotation = quaternion.identity;" instead, that should take care of the NaN issue
     
  17. Karearea

    Karearea

    Joined:
    Sep 3, 2012
    Posts:
    386
    Thanks so much for your help on this- I'll give it a go tonight and let you know how I get on. Cheers.

    Edit: Yep looks like this worked
     
    Last edited: May 14, 2023
  18. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    Thank you for the answer, but in our case it's a little more involved than that.

    We would need to get a potential component from the hit and check if the owner is the hit character controller.

    If so we would ignore the collision.

    It would be for a weapon that is shooting a rocket, and we want to have that rocket ignore the character who shot it, to prevent any possible collision.

    The layer system does not work for this and also custom tags would not work, as we want the bullet to collide with other character controllers.
     
  19. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    In "CanCollideWithHit", you have access to the "hit.Entity", and to the "context" struct. So if you add a "ComponentLookup<Rocket> RocketLookup;" to your context struct, you can check if the hit.Entity is a rocket inside of your "CanCollideWithHit", and filter collisions based on if the "owner" of this rocket is self

    This section shows an example of adding a Lookup to your context struct:
    https://github.com/Unity-Technologi...entation/Tutorial/tutorial-frictionsurface.md

    Then you'd also need to make the rocket ignore the character, but that depends on how your rocket is implemented (rigidbody? raycast? etc...). If the rocket is a dynamic rigidbody, you can use a custom body pairs job to filter out very specific hits. If it's raycast-based, you can ignore hits based on checking for character components on the rocket raycast hit entities
     
    Last edited: May 15, 2023
  20. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    Thank you @philsa-unity, should have studied all the tutorials more, very interesting implementation and possibility to customize.

    Thank you, that is exactly what I was looking for.
     
  21. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    The 1.0.0-exp.22 character package is available now and fixes this issue. Dynamic Triggers + Characters should now be working

    (this version depends on the 1.0.8 Entities package)
     
  22. Guedez

    Guedez

    Joined:
    Jun 1, 2012
    Posts:
    827
    I have bought and am using the C# version that came out before the ECS version, I've done some changes to it where basically 90% of the variables of the controller into a separate structure which I called State.
    So the character may be on the "Running State" where it moves faster, the "Swimming State" where it calls custom code instead of the default movement code, has no gravity and different air movement mechanics, "Crouched State" where the hitbox is smaller and it moves slower, etc
    I assume the same can be done here too? I am about two years away from having the time to upgrade my project, but I will have to get onto it eventually.
     
  23. rthorat

    rthorat

    Joined:
    Feb 18, 2018
    Posts:
    6
    The controller is broken again with the 1.0.10 release. There are quite a few changes, such as the TransformAspect being removed and other methods missing. Will the package be getting an update soon to fix these issues?
     
  24. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    It shouldn't be broken. Those changes were pushed in 1.0.8 update. The 1.0.10 update didn't have breaking changes. I am currently using it on 1.0.10 with Controller package 1.0.0-exp.22
     
    philsa-unity likes this.
  25. rthorat

    rthorat

    Joined:
    Feb 18, 2018
    Posts:
    6
    Never mind. I was trying to upgrade from an older project and that produced these errors on compile. But starting over with a fresh project compiles fine. Upgrading packages always seems to break Unity.
     
  26. pcg

    pcg

    Joined:
    Nov 7, 2010
    Posts:
    292
    SOLVED!

    Hi @philsa-unity

    I'm just playing around with the character controller and I'm trying to get it to carry an object in a similar way as described in the ECS examples for Kickball.

    I'm new to ECS so apologies if I'm doing something wrong.

    I'm using first person and I spawn an object a short distance in front of the player.
    I've created an ISystem to keep the carry object in front of the player and this works fine when i'm looking around but there's a lot of judder on the object I'm carrying when I move. I've tried running the system at different points but I can't seem to get rid of the issue.

    I'm going to try re-parenting the carry object to the player instead but I just wondered if there was something else I could have done to fix this.

    Edit: SOLVED
    Putting the position update code system after the CharacterInterpolationSystem and before the ParentSystem solved the judder.
    Code (CSharp):
    1.  
    2. [UpdateInGroup(typeof(TransformSystemGroup))]
    3. [UpdateAfter(typeof(CharacterInterpolationSystem))]
    4. [UpdateBefore(typeof(ParentSystem))]
    5.  
     
    Last edited: Jun 21, 2023
  27. HBG-Mathieu

    HBG-Mathieu

    Joined:
    Feb 16, 2023
    Posts:
    59
    Hello,
    I'm just curious about why there is a custom physic folder in the basic sample ? That's quite a good amount of files ^^
    I didn't find any inputs in the documentation (but that may just be me).

    Have a nice day !

    Edit : I'm stupid, most of the files are for authoring like in the physics samples...
    Edit 2 : Okay so it looks like it's just used to know if you just "enter" into your teleporter, but of course could be used for more. Or did I miss something?
     
    Last edited: Jul 6, 2023
  28. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    The custom authorings are also used to define collision filters and custom tags on certain bodies, like the "Ignore Grounding" and "Bouncy Surface" spheres, or the physics tag on the vehicle that makes it simulate an infinite mass against characters

    Parts of the sample could easily be converted to the built-in physics components, but since some things need the custom authorings, I'd rather have everything (or almost) use the custom authorings which give you more power (for now)
     
    Last edited: Jul 6, 2023
    BreakingPointDev and HBG-Mathieu like this.
  29. UnkelRambo

    UnkelRambo

    Joined:
    Oct 26, 2012
    Posts:
    80
    Hi @philsa-unity! I just checked this package out yesterday and it looks like exactly the sort of thing I could use for my open world co-op project using Netcode for Gameobjects.

    Currently I support ~1000 "moving" objects running around at ~60fps on my beastly workstation, most of my frame time going to the character controller update. I've got a perfect scenario to DOTSify several systems in my game, and thought I would start with the ECS character controller.

    However, I immediately hit a snag here:

    Code (CSharp):
    1. /// <summary>
    2.         /// Handles the conversion from GameObject to Entity for a character
    3.         /// </summary>
    4.         /// <param name="baker"> The baker that want to bake a character </param>
    5.         /// <param name="authoring"> The monobehaviour used for authoring the character </param>
    6.         /// <param name="authoringProperties"> The properties of the character </param>
    7.         /// <typeparam name="T"> The type of the monobehaviour used for authoring the character </typeparam>
    8.         public static void BakeCharacter<T>(
    9.             Baker<T> baker,
    10.             T authoring,
    11.             AuthoringKinematicCharacterProperties authoringProperties) where T : MonoBehaviour
    12.         {
    13.             if (authoring.transform.lossyScale != UnityEngine.Vector3.one)
    14.             {
    15.                 UnityEngine.Debug.LogError("ERROR: kinematic character objects do not support having a scale other than (1,1,1). Conversion will be aborted");
    16.                 return;
    17.             }
    18.             if (authoring.gameObject.GetComponent<Rigidbody>() != null)
    19.             {
    20.                 UnityEngine.Debug.LogError("ERROR: kinematic character objects cannot have a Rigidbody component. The correct physics components will be setup automatically during conversion. Conversion will be aborted");
    21.                 return;
    22.             }
    23.  
    24.             Entity characterEntity = baker.GetEntity(TransformUsageFlags.Dynamic | TransformUsageFlags.WorldSpace);
    25.  
    26.             // Base character components
    27.             baker.AddComponent(characterEntity, new KinematicCharacterProperties(authoringProperties));
    28.             baker.AddComponent(characterEntity, KinematicCharacterBody.GetDefault());
    29.             baker.AddComponent(characterEntity, new StoredKinematicCharacterData());
    30.  
    31.             baker.AddBuffer<KinematicCharacterHit>(characterEntity);
    32.             baker.AddBuffer<KinematicCharacterDeferredImpulse>(characterEntity);
    33.             baker.AddBuffer<StatefulKinematicCharacterHit>(characterEntity);
    34.             baker.AddBuffer<KinematicVelocityProjectionHit>(characterEntity);
    35.  
    36.             // Kinematic physics body components
    37.             baker.AddComponent(characterEntity, new PhysicsVelocity());
    38.             baker.AddComponent(characterEntity, PhysicsMass.CreateKinematic(MassProperties.UnitSphere));
    39.             baker.AddComponent(characterEntity, new PhysicsGravityFactor { Value = 0f });
    40.             baker.AddComponent(characterEntity, new PhysicsCustomTags { Value = authoringProperties.CustomPhysicsBodyTags.Value });
    41.  
    42.             // Interpolation
    43.             if (authoringProperties.InterpolatePosition || authoringProperties.InterpolateRotation)
    44.             {
    45.                 baker.AddComponent(characterEntity, new CharacterInterpolation
    46.                 {
    47.                     InterpolateRotation = authoringProperties.InterpolateRotation ? (byte)1 : (byte)0,
    48.                     InterpolatePosition = authoringProperties.InterpolatePosition ? (byte)1 : (byte)0,
    49.                 });
    50.             }
    51.         }
    That check for the scale being 1 is a killer since a big part of the "shenanigans" in my project comes with growing and shrinking objects in the world.

    So, my questions:

    1. Is there an ETA on when scaling would be supported? Even uniform non-one scaling would be preferred (and shouldn't be too bad to implement IMHO.)
    2. If uniform scaling isn't a high priority outcome for you, is there a github repository somewhere I could contribute to? I didn't see anything in the official Unity github repo...
    3. If not 1 or 2, I *could* hack my way around this my swapping the character controller component at runtime since ALL object sizes in my game are pre-determined (size of a dog, size of a human, size of a horse, etc.) But I'm not familiar with the latest ECS workflow so how would you suggest I go about doing this?

    I'm leaning toward option #3, personally.

    Thoughts?

    Thanks in advance!
     
  30. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    Looking into this, I noticed support for uniform scaling of characters is actually pretty close to being functional now that physics has support for uniform scale in rigidbodies and queries. I'll be evaluating the possibility of including this in a future update. I got a quick proof of concept working by doing only these changes in the sources, but I'll need to do more extensive testing just to make sure this is fine:
    • In CharacterInterpolationJob, the final "localToWorld.Value" must be built including the uniform scale of the LocalTransform component. This can be done with "localToWorld.Value = float4x4.TRS(....)"
    • In KinematicCharacterAspect, all "new ColliderDistanceInput" and "new ColliderCastInput" must be constructed with the uniformScale parameter
    ---

    For the time being however, point #3 would be a good alternative, although you actually could modify the dimensions of the collider directly rather than swapping it. You can find an example of how to do this in the Platformer Sample code (see "SetCapsuleGeometry()")
     
    Last edited: Jul 20, 2023
    UnkelRambo likes this.
  31. UnkelRambo

    UnkelRambo

    Joined:
    Oct 26, 2012
    Posts:
    80
    Thanks for the update! I'll poke around a bit when I have some time and see how it goes, appreciate the response :D
     
  32. HBG-Mathieu

    HBG-Mathieu

    Joined:
    Feb 16, 2023
    Posts:
    59
    Hello, I'm playing around since a few days with the package and the samples.
    Pretty interesting so far ^^
    But there is a little "bug" that bothers me on every samples (at least Basic and Platformer) : ground snapping give some imprecisions and makes the character always moving on y-axis (like from 0,0001). I looked in the debugger and looks like time to time the character position before the check isn't the same. No problem when the snappings is off though.
    Should I open an issue ? Is it something intended?

    Have a nice day !
     
  33. UnkelRambo

    UnkelRambo

    Joined:
    Oct 26, 2012
    Posts:
    80
    Hi again @philsa-unity , curious if you're planning on integrating IEnableableComponent here at all or if there's a way to disable movement updates that I'm missing? I've got a use case that would benefit from frequent enable/disable of the character movement but not the rigidbody (well, sometimes the rigidbody...)

    Thoughts?
     
  34. HBG-Mathieu

    HBG-Mathieu

    Joined:
    Feb 16, 2023
    Posts:
    59
    I'm not sure if that's enough because I didn't dive into it, but while waiting for philsa, something is actually in the code :

    Code (CSharp):
    1. /// <summary>
    2.     /// A component holding the transient data (data that gets modified during the character update) of the character
    3.     /// </summary>
    4.     [System.Serializable]
    5.     public struct KinematicCharacterBody : IComponentData, IEnableableComponent
    6.     {
     
    UnkelRambo likes this.
  35. UnkelRambo

    UnkelRambo

    Joined:
    Oct 26, 2012
    Posts:
    80
    This is exactly what I was looking for, thanks for pointing it out!
     
    HBG-Mathieu likes this.
  36. fas3r_

    fas3r_

    Joined:
    May 6, 2021
    Posts:
    11
    Hello @philsa-unity ,

    does the online FPS example can be follow as good practice when it comes to fps character controller ? How many players could it host if I may ask ?

    I really like the way how you organized your example

    Thanks
     
    Last edited: Aug 20, 2023
  37. m00seCS

    m00seCS

    Joined:
    Jul 16, 2022
    Posts:
    4
    I am experiencing a bug with the ECS character controller package, reported via IN-53341. When I spawn new characters, these characters all refer to the same physics collider, such that modifying the collider of one character modifies that of all the others.

    The characters are otherwise moving and acting according to input correctly, the "capsule modification to everyone at once" only occurs when I edit (Unity.Physics.CapsuleCollider*)phyicsCollider.ColliderPtr->Geometry, and I can see via entities hierarchy at runtime that the PhysicsCollider components on the characters all have the same hash. This seems like a bug with the character controller to me.

    This occurs whether or not the character uses a PhysicsShape or CapsuleCollider, and whether or not the PhysicsShape has forceUnique set. Characters are baked via "KinematicCharacterUtilities.BakeCharacter(this, authoring, authoring.CharacterProperties);".
     
  38. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    Did you check the "Force unique" option in the collider component?
     
  39. HBG-Mathieu

    HBG-Mathieu

    Joined:
    Feb 16, 2023
    Posts:
    59
    Hey guys, just a naive question :
    Why the Kinematic Character Variable Update Group isn't in the Variable Rate Simulation System Group ?

    On the same stuff, why does the Kinematic Character Physic Update Group is inside After Physics System Group and not between Physic Simulation System Group and the After one, like the Statefull Collision Event Buffer System ? It looks more like a physic update extension no ?
     
    Last edited: Aug 31, 2023
  40. m00seCS

    m00seCS

    Joined:
    Jul 16, 2022
    Posts:
    4
    You'll see in my comment: "This occurs whether or not the character uses a PhysicsShape or CapsuleCollider, and whether or not the PhysicsShape has forceUnique set."
     
  41. bnmguy

    bnmguy

    Joined:
    Oct 31, 2020
    Posts:
    137
    Yes, sorry I missed that.
     
  42. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    The issue is that Force Unique makes the baked character prefab have a unique collider, but when you instantiate that prefab, the instances all just point to that prefab's "unique" collider. The collider is unique to the prefab, but not to the instances of it.

    In order to solve this, you'd have to handle creating a collider copy for new characters you instantiate. You can do this with Collider.Clone(). And you also need to remember to manually dispose that collider blob asset before the entity gets destroyed (you can use an ICleanupComponent for this)
     
    Opeth001 likes this.
  43. Ondrej98

    Ondrej98

    Joined:
    Oct 18, 2016
    Posts:
    21
    Hello, I tried using the character controller (1.0.0-exp.22) with the terrain workaround, putting the collider into a subscene. However the character falls straight through. It works well with other types of colliders in the subscene. I also tried dropping rigidbodies onto the terrain and they fall through the terrain collider but collide with other colliders.
     
  44. AtomicElbow

    AtomicElbow

    Joined:
    Aug 11, 2016
    Posts:
    13
    Hi! I'm having some jitter issues when using a networked third person character.
    It is still present even if character interpolation is enabled. The problem is more noticeable when running the network simulator and introducing some jitter and package loss.

    See attached video as example (may needs to be downloaded to see the jitter due to compression)
    https://drive.google.com/file/d/1MNeDy-IZPtu3Lj7RcSZuv8gKdFHKKO8u/view?usp=sharing

    Is this behaviour "intended". I can observe the same behaviour in the "OnlineFPS" sample demo as well.

    My guess is no jitter buffer is implemented in the interpolation, which makes the interpolation sensetive to.. jitter.

    Thank you for your plugin, it works great, we're just curious if we have missed something obvious.
     
    Opeth001 likes this.
  45. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
  46. AtomicElbow

    AtomicElbow

    Joined:
    Aug 11, 2016
    Posts:
    13
    Thank you Opeth. There indeed seems to be some issue with that value. When setting it correctly on both ClientWorld and ServerWorld, it works like a charm.

    For anyone else experiencing the same issue. It's NetCode related and not this Character Controllers's "fault".

    Solution:
    Code (CSharp):
    1. // Do the same for ServerWorld
    2. ClientWorld.GetExistingSystemManaged<PredictedFixedStepSimulationSystemGroup>().RateManager.Timestep = 1f / tickRate.SimulationTickRate;
     
    Opeth001 likes this.
  47. DatCong

    DatCong

    Joined:
    Nov 5, 2020
    Posts:
    87
    why when moving character IsGrouned is set to false ?
     
  48. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    Do you have more info on when this happens?
     
  49. DatCong

    DatCong

    Joined:
    Nov 5, 2020
    Posts:
    87
    hhhh just install package, follow the document, and when moved thirdpersoncharcter in xz axis, IsGrounded be set to false.
     
  50. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    Could you share either a repro project or a video of the sort of geometry your character is standing on when this happens? Additionally; at what point in the frame are you looking at the IsGrounded value