Forum rules - please read before posting.

Integrating Unity's Ethan Third Person Prefab

Is there anyway to integrate the default third person character prefab (Unity's Ethan) into Adventure Creator? I've seen tutorials for other third person options, but none that seem to work for this particular option. Thoughts?

Comments

  • Welcome to the community, @Ktheorin1.

    Getting two character-controller assets to work together requires an integration script to bridge them together - i.e. determine which one "has control" at any one time.

    A script for integrating AC with Unity's ThirdPersonController can be found here:
    http://adventure-creator.wikia.com/wiki/Unity_Third_Person_Controller_integration

    As is often the case with such integrations it may require further tweaking, but it should be good for general usage.

    A more detailed guide on creating custom motion controllers can be found in the Manual, as well as this tutorial.
  • Thanks for the quick response! Few questions about integrating tho:
    1. When it says to place the integration script on the character's root object, does that just mean to drop the script right under where you dropped the player script?
    2. Why does the jump appear to be extremely exaggerated when used in adventure creator? The third person prefab is able to jump extremely high once integrated.
    3. I've configured the nav mesh agent and it works great when I set the settings to point and click navigation, but only when I click on a hotbox that the player has to approach. Otherwise, in both direct and point and click mode, the character doesn't move. In direct mode, which I plan on using, the character is able to turn, but not move towards the target. Any ideas of how to fix this?
    4. Last question, I know how to make the third person prefab walk instead of run by default, but since the user control script is now gone, I'm not sure how this is done. Any ideas of where to change this setting?

    Sorry for all the questions.
  • I think number 2 is because jumping is being applied twice. Adventure Creator has jump as an available input for Direct Control movement method, but Unity's Third Person Character Prefab probably has a jump as well, mapped to the same button. I have never used Unity's character controller so I can't really help with it, but I think that's what is probably happening.
  • I'm not sure that this is the reason. When I set the jump power of the third person prefab, it can barely jump at all. As a side note, it doesn't seem to matter what my player animation engine is set to in order for the character to function (right now it's set on sprites unity, but acts the same no matter what setting I choose).
    1. Yes - the Player, Third Person Character, and Unity Third Person Integration components all need to be on the character's root object.
    2. @Deckard_89 is correct - both AC's and the TPC's jumping feature is mapped to the "Jump" input, and AC mistakenly still allows for jumping even when Motion control is set to Manual.  I shall address this in the next update, but in the meantime you can disable AC's jumping by using the Player: Constrain Action to lock it.
    3. Check that your floor collider is placed on the NavMesh layer.  AC's Point And Click mode requires that your walkable region be placed on this layer, so that mouse clicks know to detect it.  For more on this can be found in the "Unity Navigation pathfinding" chapter of the Manual.
    4. The integration script shares the same direct-movement code as the ThirdPersonUseControl script.  The "shift-to-walk" in both can be changed to "shift-to-run" by changing:

    if (Input.GetKey (KeyCode.LeftShift))

    to:

    if (!Input.GetKey (KeyCode.LeftShift))
  • Where is the Player: Constrain action? Can't seem to find it.
    Also, I'm hoping to use direct control for the player, but have them move towards an object when clicked. Since the link provided to the wiki about using NavMesh agent for controlling the player during cutscenes said to change the AC settings to Unity Navigation, that is what I did. I'm not quite sure what the navmesh layer is in this context as there doesn't seem to be any place to assign it.
  • You're using the latest release?  It's in the "Player" category of Actions.  Check the Actions Manager - you should fine it listed there.

    GameObject layers are assigned at the top of their Inspectors.  It's likely set to "Default" at the moment, and AC should have automatically created the "NavMesh" layer upon install.

    Changing the layer is only necessary when using Point And Click movment.  With Direct, baking a NavMesh and setting the Pathfinding method to Unity Navigation is enough.
  • I'm kind of a novice here, so I apologize for all the questions. So I placed the constrain into the OnStart section of the map. Will that always remain on the player for the entire game even between levels? As for the pathfinding, the game seems to think that player has moved to the hotbox when I set the setting to "Move To" because it players the next part of the actions. However, when I say move to marker, it won't progress in the script. It seems the navigation layer has been baked correctly, yet the player still won't move. If you want, I could provide a link to the project if that would help.
    • I placed the constrain into the OnStart section of the map. Will that always remain on the player for the entire game even between levels?
    It will reset with the scene, but an update that fixes the issue (for which the above is a workaround) will be released soon.

    • When I say move to marker, it won't progress in the script. It seems the navigation layer has been baked correctly, yet the player still won't move.
    Is the Marker defined, and placed on the floor inside the boundary of the NavMesh?   Are any Console messages warning you about anything?  If you replace your own player with the 3D Demo's, Tin Pot (found in /AdventureCreator/Demo/Resources), does he work as intended?  Please share screenshots showing your scene setup.

    • If you want, I could provide a link to the project if that would help.
    If necessary we'll come to that - but try the above first and let me know the results.
  • The Tin Pot character does appear to work. Not sure how to figure out the differences between these two. Any thoughts?
  • Also, is there now an option to disable the extra jump? Where would I find this or is it automatic?
  • edited March 2018
    I'm not sure what you mean exactly - please give as much detail as you can, especially when custom/third-party scripts are involved.

    By Tin Pot, you mean the 3D Demo game's unmodified player prefab?  What do you mean by him not working?  Is he not spawning into your scene, or not responding to control?  Are you using any of the integration code / Third Person Controller at the start of this thread?

    By "extra jump", do you mean the AC jump in addition to one from the custom controller?  The latest update prevents AC from jumping if the player's Motion control field is set to Just Turning, which the integration script will set for you.
  • Sorry for being vague. The Tin pot demo character works fine in the scene. He spawns and moves to object markers when I click on them. That means that the scene pathfinding works fine and that it's my third person ethan character that won't pathfind correctly. Now I'm just trying to figure out what I can do to fix that.
  • Your scene relies on Unity Navigation for pathfinding, and Ethan has a NavMeshAgent component as well as the script I posted above?  Does he move at all, or remain frozen?

    If you can share images showing your scene setup and player character, I will see if anything comes to mind.
  • The player character only turns to look, but does not walk. I've shared all the settings I have on the player since the scene is set up correctly because the Demo Tin Pot Character works fine in it. imageimageimage
  • If the character is turning, then AC is doing its part OK.

    I see the NavMeshAgent's Area Mask is set to "Mixed" - how about if you change it to "Everything"?

    Also, enable "Gizmo" at the top of the Game window.  Does the player's "blue line" target appear pointing to the clicked navigation position when clicking around the scene?
  • Changing it from mixed to everything only reenables mixed. I cannot set it to everything. I believe I enabled the blue line setting and the player is point to the target. I am willing to provide the file if that would at all help.image
  • The AC script isn't controlling it - and it doesn't look like the Unity TPC script does either.  I can't guess why "Mixed" would be enforced - you're not using any other scripts?

    Feel free to PM me the file, but from the sounds of it it'd be best to see all the files (scripts, models, animation) associated with the prefab as well - not just the prefab itself.
  • Sent a message
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.