Search Unity

[RELEASED] Rival - DOTS Character Controller

Discussion in 'Assets and Asset Store' started by PhilSA, May 31, 2021.

  1. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Thanks for pointing this out, I'll look into it.

    So if I understand correctly, one character changing its collider will change the colliders of all characters when using this approach? We'd have to look into what is the proper way to create a real copy of a physics collider
     
  2. wooolly

    wooolly

    Joined:
    Aug 12, 2017
    Posts:
    9
    Great thanks for the help PhilSA, I'll have a play with the asset and see how I get on.
     
  3. Marco-Playable

    Marco-Playable

    Joined:
    Nov 12, 2020
    Posts:
    53
    Correct.
     
  4. Luxxuor

    Luxxuor

    Joined:
    Jul 18, 2019
    Posts:
    89
    I ran into this exact same problem, you just have to check the "Force Unique" checkbox on the PhysicsShape of the problematic prefab. The physics package by default shares one instance for all colliders with the same parameters.
     
  5. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Work is ongoing to convert Rival to dots 0.50

    The core CC converts relatively easily, but the samples need some rework mostly due to changes in Animation and Netcode. Doc also needs a bit of rewriting to reflect the changes

    I'll post again when I have a clearer idea of when it could be finished
     
    the_unity_saga, andywatts and Xaon like this.
  6. andywatts

    andywatts

    Joined:
    Sep 19, 2015
    Posts:
    112
    Thanks @PhilSA.
    If examples will take a while, would appreciate a partial update for the prefabs and Core CC.
    I'm andywatts on GitHub and could perhaps contribute PRs if you're open to it.
     
  7. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    What I can do is if you send me an email at my store support email ( store.pstamand@gmail.com ) along with your invoice#, I can send you a working version of the core scripts and standard characters
     
    andywatts likes this.
  8. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Looks like I'm out of the woods with the update to 0.50

    I ended up doing a pretty significant refactor to the OnlineFPS sample (not all related to 0.50) in order to improve the code clarity & quality

    The Rival update will probably be ready within a week. I just need to review the doc & tutorials, and package everything
     
  9. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Rival 0.4 is now available!

    The main changes are:
    - Update to DOTS 0.50
    - OnlineFPS refactor
    - Platformer uses Hybrid animation
    - Fixed potential non-determinism

    Keep in mind this update invloves breaking changes.

    You can see the whole changelog here: https://philsa.github.io/rival-doc/changelog
     
  10. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Just bought this, and want to get into the whole DOTS thing. I've been out of the loop a few years but what better way to start? Thanks Phil.
     
    PhilSA likes this.
  11. ParhamXTT

    ParhamXTT

    Joined:
    May 24, 2020
    Posts:
    28
    Can I create a medieval Real Time Strategy game like Stronghold series with this package?
    *I am not talking about MMO , RPG, FPS, TPS. I am talking about RTS ( Real Time Strategy)
     
  12. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    In theory you can, but it's probably not a great choice. A better option would be using NavMesh characters, but there's currently no official package for doing that in DOTS yet. You'd have to figure out a way to use the old navmesh system

    Character controllers like this are a better fit for games where your characters need to simulate "physics", and where they can get off the ground. In most RTS games, you don't need any of that, so the added cost of physics simulation is pointless
     
    Last edited: Apr 15, 2022
    hippocoder likes this.
  13. Marco-Playable

    Marco-Playable

    Joined:
    Nov 12, 2020
    Posts:
    53
    Is there any more documentation on ledge grabs for the platformer and how to best set up the colliders for it?

    I am still struggling with an automatic transition from climbing to walking at the top of scalable walls... Right now I am checking the average normal in ClimbingState and once a certain angle is reached, request a transition to ground move state. At that time the feet of the player are likely still hanging off the edge and this causes the player to now immediately start falling again.
     
  14. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    I'm considering doing a really massive overhaul of the samples-related documentation (mostly for Platformer and OnlineFPS) where I explain every single thing in great detail. However, because there are upcoming features in DOTS 1.0 that Rival would benefit from immensely (the feature in question is Aspects), I've decided to wait until I've converted the samples to use this before I put in all that documentation work

    But essentially, for "standing up on ledge from climbing state", you'd probably have to:
    • Check every individual hit normal detected by the climbing sphere's "CalculateDistance"
    • Check if at least one of those normals is at a low enough slope angle to be a candidate for being grounded on it (using KinematicCharacterUtilities.IsGroundedOnSlopeNormal())
    • Find the direction "moveDir" that you are moving in while climbing
    • Do something similar to what "LedgeGrabState.DetectTransitions" does when we press the jump key (more specifically the "LedgeDetection" function called here). Basically, you'd want to do a downward "KinematicCharacterUtilities.CastColliderClosestCollisions" at the position of the blue character in this drawing, and then, if all hit fractions are >0f (so if there are no overlapping colliders), call your characterProcessor's "IsGroundedOnHit()" at that hit point. If grounded at that point, that would be the point where you'd want to stand up to.
    • However, if you attempt to move directly from the green position to the blue position, you'll be blocked by the collisions in between the two. At this point, the strategy to employ is completely up to you, but I'd suggest disabling character collisions as that "moving up the ledge" transition is happening. There is a function for this: "KinematicCharacterBody.SetCollisionDetectionActive()". Right now in the sample, we teleport from green to blue. But the plan is to eventually run a rootmotion animation that would take us from green to blue
     
    Last edited: Apr 22, 2022
  15. Marco-Playable

    Marco-Playable

    Joined:
    Nov 12, 2020
    Posts:
    53
    Thank you Phil, getting closer!
    The remaining issue I am facing is that a ledge is detected (CanGrabLedge==true) and I enter the LedgeGrabState. In the next OnStateUpdate, the upOffsetToPlaceLedgeDetectionPointAtLedgeLevel value is added to the character translation and the character's rotation gets adjusted as well. After this happens the character is now too far away to still hold on to the ledge and starts falling down. I am not sure yet if this due to the 0.04 / 0.02 offsets in that file or because the rotation pivots the character away too much.
     
  16. Sunstrace

    Sunstrace

    Joined:
    Dec 15, 2019
    Posts:
    40
    I try to check the rival sample today.but after i import the sample,it give me a error:
    Library\PackageCache\com.unity.dataflowgraph@0.19.0-preview.7\Runtime\AtomicSafetyManager.cs(32,74): error CS8377: The type 'T' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'

    this error maybe caused by the dots animation package,Is there a solution to fix it?

    In my project ,i want to change the character gravity direction.For example,change the gravity direction from (0,-1,0) to (-0.5,-0.5,0).when the gravity change,i expect the character's up direction changes too .Is there a way to do this?
     
    Last edited: May 8, 2022
  17. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    As far as I know, the DOTS Animation package isn't compatible with DOTS 0.50+ anymore, which is why I had to remove it. If you imported the Sample from a clean new project, normally it shouldn't add the Animation package. But if you imported it into an existing project that already had the Animation package, you'll have to remove the package manually (this and dataflowgraph)

    The orientation of the character should be handled in the same place where regular rotation is handled. So in the ThirdPersonCharacter for example, this would be in ThirdPersonCharacterRotationSystem. Currently, this system only says your rotation should point towards your move direction, but you'd have to add some code right before that that rotates the character to face a given up direction. Here's what this could look like:
    Code (CSharp):
    1.  
    2. Entities.ForEach((
    3.     Entity entity,
    4.     ref Rotation characterRotation,
    5.     ref ThirdPersonCharacterComponent character,
    6.     in ThirdPersonCharacterInputs characterInputs,
    7.     in KinematicCharacterBody characterBody) =>
    8. {
    9.     // Orient character up towards gravity
    10.     characterRotation.Value = MathUtilities.CreateRotationWithUpPriority(math.normalizesafe(-character.Gravity), MathUtilities.GetForwardFromRotation(characterRotation.Value));
    11.  
    12.     // Rotate towards move direction
    13.     if (math.lengthsq(characterInputs.MoveVector) > 0f)
    14.     {
    15.         CharacterControlUtilities.SlerpRotationTowardsDirectionAroundUp(ref characterRotation.Value, deltaTime, math.normalizesafe(characterInputs.MoveVector), MathUtilities.GetUpFromRotation(characterRotation.Value), character.RotationSharpness);
    16.     }
    17.  
    18.     // Add rotation from parent body to the character rotation
    19.     // (this is for allowing a rotating moving platform to rotate your character as well, and handle interpolation properly)
    20.     KinematicCharacterUtilities.ApplyParentRotationToTargetRotation(ref characterRotation.Value, in characterBody, fixedDeltaTime, deltaTime);
    21. }).Schedule();
    (the only line I've added is the one under the "// Orient character up towards gravity" comment)
     
  18. Sunstrace

    Sunstrace

    Joined:
    Dec 15, 2019
    Posts:
    40
    Thanks,It works!
     
  19. vzlomvl

    vzlomvl

    Joined:
    Jun 25, 2016
    Posts:
    43
    Hey Phil.
    I am wondering why you have limitation to use only 2020.3.30 version in the asset store? upload_2022-6-10_17-11-53.png
    Rival - DOTS Character Controller | Physics | Unity Asset Store
    As far as I know Unity recomend to use Unity 2020 LTS (min 2020.3.30) so it should be ok from Unity DOTS perspective to use 2020.3.30+ versions. upload_2022-6-10_17-12-16.png
    Official - Experimental Entities 0.50 is Available - Unity Forum
    Was this restriction added due to a Unity restriction, and if so, is it safe to use the library on Unity 2020.3.30+?
    Thanks.
     

    Attached Files:

  20. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    The limitation was only there because at the time of writing the description, I falsely assumed DOTS was only validated for 2020.3.30. Rival should work with future 2020.3.30+ versions as well

    I'll remember to update the description next time I push an update, thanks!
     
    vzlomvl likes this.
  21. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,117
    congratulations @PhilSA just came across your package on the asset store, it seems to have some really good stuff in it.
    I've pretty much read all of your documentation (I haven't bought it yet) but it's definitly something ill do to see how you've done all that good stuff.
    I have 2 questions by the way:
    1) Do you plan to update to the latest DOTS version (0.51) or is it already compatible?
    2) Have you separated Rival's features into multiple modules that can be easily integrated or everything bundled into one complete solution?
     
  22. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    Yes, working on it at the moment (I believe the upgrade will be very easy, but I just want to finish another minir fix before)

    The goal with Rival is to give you a strong character controller starting point, and then leave the implementation of all the gameplay-specific features in your hands. For example, all the movement features (climbing, swimming, etc...) in the Platformer sample were coded specifically for that sample. They are there as a source of inspiration for you to copy them, but they are neither integrated into the core Rival CC, or available as a plug-in module

    Making modular pluggable movement features is something I'm thinking about for the future though. It can be a little tricky because the implementation of these things can get very game-specific, especially in cases where movement and animation are intertwined
     
    JohngUK and Opeth001 like this.
  23. ashwinFEC

    ashwinFEC

    Joined:
    May 19, 2013
    Posts:
    49
    What's a good way to attach other kinematic Physics bodies to the character, like for triggers and such. I tried tracking the character by attaching a TrackedTransform to the root of the Character controller and then applying the position and rotation from that TrackedTransform to the Translation and Rotation component of the attached Physics Body. But the attached Physics Body is always lagging behind the Character when the character moves. I tried adding the value from CalulatePointDisplacement to the Translation value but then the attached Physics Body moves away from the character when the character rotates.
     
  24. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    I think the simplest way to deal with this would be:
    1. Place "empty" transform entities as children of the character entity
    2. Make a component+system to make a certain rigidbody set its Translation+Rotation to a target transform's LocalToWorld.position and LocalToWorld.rotation every frame
      1. The targeted transforms would be those emty child entities from point 1
      2. We need to use the target's LocalToWorld instead of its Translation/Rotation, because only LocalToWorld is interpolated
      3. That system should update after TransformSystemGroup, where the LocalToWorld are recalculated
    3. Call World.GetOrCreateSystem<TransformSystemGroup>().Update() manually after your "MakeRigidbodyFollowTargetSystem" has run. This will calculate up-to-date LocalToWorlds for your rigidbodies, after they've copied their target's
    The necessity for point 3 is unfortunate, but so far I haven't had a better idea that takes into account character interpolation (which is important to avoid jitter).

    The alternative would be to write a custom fixedStep parenting system that makes rigidbodies follow a character, and then write a custom interpolation system for those rigidbodies. I think this is a problem we'd have even when just making any kinematic rigidbody behave like a child of any other rigidbody, whether it's a Rival character or not. It might be worth asking about it on the dots physics forums

    _________________

    EDIT: started a thread
    https://forum.unity.com/threads/how-to-handle-rigidbody-parenting-with-kinematic-bodies.1300116/
     
    Last edited: Jun 24, 2022
    Zyblade and ashwinFEC like this.
  25. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    An update on DOTS 0.51:

    Seems like everything upgrades fine except for an error with netcode generators. It's the same issue described in this thread:
    https://forum.unity.com/threads/0-5...code-metadata-reference-for-assembly.1296129/

    For now this prevents the samples from compiling. I will wait a few days to see if a fix is found, but if this takes too long I might just add a dependency to NetCode in all Rival samples as a temporary fix

    But aside from that, Rival can safely be upgraded to 0.51 without any changes required
     
    Last edited: Jun 26, 2022
    Krajca, ashwinFEC and Zyblade like this.
  26. Mirath

    Mirath

    Joined:
    Aug 5, 2012
    Posts:
    15
    Hiya @PhilSA ,

    I was really glad to see the news with DOTS and that Rival is now usable on later engine versions. I used the Kinematic Character Controller on my last game (a 3D platformer) and was curious how Rival compares. The KCC was great, but could sometimes eat into performance on certain platforms, especially the Switch. Do you have any details on how Rival matches up, or any performance benchmarks comparing the two?

    Thanks,
    Ben
     
  27. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    I haven't had the opportunity to benchmark performance on consoles, but one benchmark that I think is interesting is this: both KCC and Rival have a very similar "StressTest" scene where we spawn X amount of characters moving in circles on a floor.

    Here's how many characters both solutions can support at 60fps, on the same PC:
    KCC: 1000 characters at 60fps
    Rival: 42000 characters at 60fps

    The difference might vary with what kinds of environments your characters are moving in, and also with how many threads your CPU has (Rival can use all threads while KCC is stuck on main thread) but in general you could expect Rival to perform around 20-40x better than KCC

    CPU clock speeds haven't improved that much in the last decade, so KCC will probably have about the same performance on a 2012 2-core CPU and on a 2022 16-core CPU (because in any case, it'll only use one of these cores). Rival, however, will make good use of all of those 16 cores. But that's not all; because of Burst and ECS, Rival also performs substantially better than KCC on a single thread too; about 6-7x better according to some tests I made
     
    Last edited: Jul 26, 2022
    Krajca and hippocoder like this.
  28. Mirath

    Mirath

    Joined:
    Aug 5, 2012
    Posts:
    15
    Awesome, thanks for the info! Certainly sounds like a huge jump up on multiple fronts. Cheers!
     
  29. the_unity_saga

    the_unity_saga

    Joined:
    Sep 17, 2016
    Posts:
    273
    Congrats on selling this thing to Unity, hopefully its a giant step in making DOTS more mainstream and helping Unity over take engines such as Unreal, especially since V Rising apparently makes use of DOTS. I'll be keeping an eye on this as it progresses, was happy to help show support by being an early buyer.

    10/10 asset... hope to see the wall running example in KCC!!!1
     
    philsa-unity likes this.
  30. thelebaron

    thelebaron

    Joined:
    Jun 2, 2013
    Posts:
    857
    Also want to echo my congratulations for joining up with Unity, didn't actually get around to trying it but always happy to support DOTS assets which are in short supply :)

    Looking forward to seeing what the future cooks up for Rival or its future iterations! Also could you nudge the decision makers into getting some public dots animation previews going again? :D
     
    philsa-unity likes this.
  31. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    Hey all!

    I'm very happy to confirm Unity did acquire Rival, and I am presently continuing work on Rival at Unity :D

    You can now find the asset on this page

    There's no doubt in my mind that this is what's best for the asset:
    • I'll be able to spend more time on it and support it better
    • I'll have a better line of communication with the DOTS teams, both for questions and for feedback
    • Tutorials & all sorts of public projects will be able to rely on the asset because it is free
    • etc...
    Some of you may have also noticed that my other asset (Kinematic Character Controller) is now free, although I need to clarify that KCC was not acquired by Unity. I think this was bound to happen sooner or later regardless of the Rival acquisition, because supporting KCC was becoming a bit too much to handle for the little free time I had. I'll keep an eye on it to keep it compatible with new Unity versions, but customer support will be more limited.

    I'm really excited to see what the project will become and what DOTS in general will become. I can't reveal anything at this time, but there's lots of very exciting DOTS stuff to look forward to.

    Cheers!
     
    Last edited: Sep 10, 2022
  32. DreamingImLatios

    DreamingImLatios

    Joined:
    Jun 3, 2017
    Posts:
    4,271
    Congrats!

    You've always struck me as someone who aligns very closely with the DOTS Teams decisions, especially the ones I disagree with :p, so I think this makes a ton of sense for both you and Unity! I'm looking forward to what becomes of it!

    One quick request, is it possible to relicense Rival under UCL like the rest of the DOTS stack? That license as I understand it allows me to share demos and derivative works via public GitHub repos. I've been avoiding looking at Rival's source code due to conflict-of-interest concerns.
     
    philsa-unity likes this.
  33. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    I don't have the answer to that right now, but I'll try to ask about it
     
    DreamingImLatios likes this.
  34. Shizola

    Shizola

    Joined:
    Jun 29, 2014
    Posts:
    476
    This is the best Unity news I've heard in a while
     
  35. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Well as an early adopter of Rival, I can honestly say it's worth it.
     
    thomas_key likes this.
  36. playBlaster

    playBlaster

    Joined:
    Jan 5, 2017
    Posts:
    7
    Wow! Congratulations. That's an honor. I'm so happy they have also hired you to continue development on it. Honestly I'd be a little frightened if they hadn't. Looking forward to seeing it evolve.
     
  37. Lance-Huang

    Lance-Huang

    Joined:
    Apr 7, 2013
    Posts:
    9
    I found 2 problems when trying this asset:
    1. The performance of the physical system is very low, and each update consumes 3-6ms.
    2. Use IL2CPP to package apk, it will crash when entering the game.
    I don't know if you have these problems too? How to solve?
     
  38. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    This might be due to editor settings:
    • Make sure "Burst > Enable Compilation" is ENABLED
      burst.PNG
    • Make sure "Jobs Debugger" is DISABLED
      debugger.PNG

    This should fix the performance issue


    I'm not sure how you are making a build at the moment, but builds in DOTS have to go through "Build Configs" instead of the regular Build menu. You can find examples of these in the Rival Samples project

    But do let me know if you were already using Build Configs, and I'll look into this further
     

    Attached Files:

    Last edited: Sep 18, 2022
  39. Lance-Huang

    Lance-Huang

    Joined:
    Apr 7, 2013
    Posts:
    9
    Thank you for your prompt reply.

    The performance has improved after the Jobs Debugger is set to DISABLED, but I don't know if this is the limit of performance.
    profiler.png
    This is my Build Config settings, packaged as apk still crashes.If packaged with Mono, the game will work fine. BuildConfig.png
     
  40. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    200
    After so many years, Unity finally finds an engineer to build a high-quality character controller for it.
    Many Years ago, I had to build my own KCC (Kinematic Character Controller) by doing low-level physics simulations, since some physics APIs were missing (no Collider.ClosestPoint)...


    @philsa-unity so are you planning to still maintain your KCC (Kinematic Character Controller)? I saw it is free now after Unity acquired it. I bought it before and wanted to copy some logic (e.g. moving platform logic) from it to update my own KCC controller. I am new to this DOTS thing since I think it is still in the early stage. I am assuming you will maintain both your existing KCC and this Rival? So some of the controlling logic (e.g. moving platform logic) should be similar between your existing KCC and this Rival?
     
    Last edited: Sep 30, 2022
  41. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    Maintenance on KCC will probably be limited to keeping it compatible with latest unity releases. Just to clarify; KCC isn't acquired by unity

    As for the moving platform logic, the math behind it is roughly the same in Rival, but I managed to structure things a lot better. Rival's moving platforms don't require you to move your platforms with a "PhysicsMover" anymore; you move them however and whenever you want, and as long as there's a "TrackedTransform" component on it, it'll work
     
    Emanx140 and Dan2013 like this.
  42. Dan2013

    Dan2013

    Joined:
    May 24, 2013
    Posts:
    200
    Thanks for your explanations. I think I may need to read the code of both KCC and Rival when I start to update my KCC.

    So there will be no new update added to KCC. I think it is still very helpful to maintain it (at least not break with the latest Unity LTS), since not every developer wants to move everything into ECS/DOTS immediately.
     
  43. Grizley56

    Grizley56

    Joined:
    Nov 5, 2019
    Posts:
    1
    Congrats and thanks a lot for an excellent asset, i really like it! By the way, is there approximate date when we can expect updates for last 1.0 experimental entities package?
     
    Opeth001 and chefneil like this.
  44. crowmaster

    crowmaster

    Joined:
    Jul 6, 2012
    Posts:
    83
    In my current project i am not using DOTS but i want a performant character controller (Unity builtin one turned out to be unacceptably slow).
    Can i integrate Rival in my project without need to turn whole project into DOTS?
     
  45. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    Realistically, no (unfortunately). Since Rival relies on DOTS physics, the requirement would be that everything that has collision in your game would have to be turned into entities
     
  46. 8bitgoose

    8bitgoose

    Joined:
    Dec 28, 2014
    Posts:
    448
    I haven't used Unity Physics yet. Can I have a separate collision layer for only Rival to use? Then I could technically use PhysX for everything else right?
     
  47. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    A clarification on my previous statement would be: everything that the chatacter can collide with needs to be an entity

    So let's say you take a typical gameObject game, you could add Rival in there without converting anything to entities, but then your character would fall through the ground and ignore all other collisions because it can't recognize the regular non-entity colliders.

    DOTS physics & PhysX are like 2 completely separate worlds that don't know about eachother
     
  48. docchang

    docchang

    Joined:
    Jan 30, 2014
    Posts:
    8
    @philsa-unity I'm trying to put a custom 3D model character onto the ThirdPersonCharacter. As soon as I put it on the character went horizontal and anything that has "Skinned Mesh Renderer" went outside of the body. What is the proper way to setup a custom 3D model character on the ThirdPersonCharacter?
    upload_2022-10-26_23-49-51.png
     
    Last edited: Oct 27, 2022
  49. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    115
    At the moment, skinned meshes and Animators are not conversion-compatible, which means they don't support being converted to Entities when they're in a SubScene. In order to use an animated mesh, a workaround is needed.

    Basically, you need to come up with a strategy to:
    • Remember a GameObject prefab that represents the "visuals" (animated mesh) of your character.
    • Instantiate/Destroy that GameObject prefab when your character Entity is instantiated/destroyed.
    • Make that character "visuals" prefab copy the character Entity transform at all times
    In short; the character "physics" will be in the Entity world, and the character "visuals" will be in the GameObject world. The Platformer Sample uses an approach similar to what I've described, and you can look at what the "PlatformerCharacterHybridSystem" does for a good starting point
     
    Last edited: Oct 28, 2022
    JohngUK likes this.
  50. docchang

    docchang

    Joined:
    Jan 30, 2014
    Posts:
    8
    Thanks @philsa-unity for the fast response. I'll spend some time to study that. For the animation portion. I don't have a custom animation with that model, just a humanoid rigged model. Could I use the Unity Standard 3rd Person Starter animation somehow? Or what is the proper way to configure the animation portion to work with the system?
     
    Last edited: Oct 28, 2022