Forum rules - please read before posting.

How to intergrate AC with UCC?

24

Comments

  • edited January 2021

    A UCC Player will still work in an AC scene - the steps covered are to do with ensuring that they follow AC commands during cutscenes, etc. You should find that, without the above steps, you'll still be able to control the UCC Player during cutscenes, they'll ignore Action commands, etc.

    Such behaviour may well be enough for your needs, however. When it comes to incorporating two large assets such as these, it's not really possible for a "one-size-fits-all" approach, as the needs of each project will vary - but the provided scripts intended to be a good "base level" integration for most cases.

  • In the document it mentioned to change under Interface Settings; Movement Type to direct. Is it possible to make it work for other options like Point & Click, drag

    Thanks

  • I have another question. Sorry for asking so many question. I am just getting into this.

    I created a trigger. It is only working when detection method is transform position not for rigidbody. One more thing I noticed when I switched to AC camera the controls are reversed mean 'W' going backwards and 'S' going forward. If I use UCC default camera it is fine.

    Thanks

  • Is it possible to make it work for other options like Point & Click, drag

    I would argue that UCC becomes less necessary once you start relying on AC for in-game motion control, since UCC is itself a motion-control asset. I shall investigate point-and-click motion, however.

    I created a trigger. It is only working when detection method is transform position not for rigidbody.

    Triggers can only detect Rigidbodys that also have a Collider - the default UCC Player needs to have one added manually.

    when I switched to AC camera the controls are reversed mean 'W' going backwards and 'S' going forward. If I use UCC default camera it is fine.

    The UCC character will move according to the orientation of the UCC camera - not the AC one. You could try merging / parenting the UCC Camera to AC's MainCamera, so that the UCC Camera always faces the same direction as AC's MainCamera.

  • Thanks for the prompt answers. Adventure Creator is an excellent asset and support is always very good. I will give it a good review. Thanks

  • I've updated the asset and it should now work with Point And Click movement as well.

  • Thanks, I will try it.

  • For point and click to work. Do I need to download the UCC_AC integration package and change the MovementType from Direct to Point & Click under Interface settings ?

  • Yes, you need to apply all the regular steps - i.e. bake the NavMesh / place the floor collider on the NavMesh layer.

  • I was able to make it move on point & click. It is using the AC motion ability. There are couple of things

    • While AC motion ability is active I can't use any other abilities like jump, speed change etc
    • When I click on the floor the cursor jumps around to the location of the player.

    Thanks

  • This is just a suggestion, but it would be nice if the assets in the download page had version numbers/release dates so by just looking at it we know if we are using the latest version available.

  • While AC motion ability is active I can't use any other abilities like jump, speed change etc

    This is when using Point And Click? Since you're mixing motion styles, you'd need to write a custom motion ability for that kind of behaviour.

    When I click on the floor the cursor jumps around to the location of the player.

    I'm afraid I don't follow. Can you share a gif/video?

  • I was under he assumption that by using AC motion ability, I can automatically switch between different ability like switching from Speed change to jump.

    How do you attach a video clip. There is no option in this editor ?

  • edited February 2021

    I was under he assumption that by using AC motion ability, I can automatically switch between different ability like switching from Speed change to jump.

    The AC Motion ability allows for UCC to be commanded by AC in terms of rotation / pathfinding when necessary. But the motion itself is still handled by UCC - AC is not in control of things like speed changes etc. Those would be changed as you would with any regular UCC project.

    Do bear in mind, though, that given that the two assets have such a wide scope, it's likely that you'll want to make changes / extend the integration to suit the specific needs of your project.

    How do you attach a video clip. There is no option in this editor ?

    For security, files cannot be uploaded directly onto the forum. Upload them somewhere else e.g. imgur or Dropbox, and paste links to them here.

  • Hello, I'm using AC with player switching (basically because It's easier to setup a character with freeroam and set up another with combat skills while using AC to keep control of when to use them, it also gives more flexibility).

    For making the UCC cam work with the new character I added to the AC_UCC_Character the function:

                controlCam = FindObjectOfType<CameraController>();
                controlCam.Character = KickStarter.player.gameObject;
    

    And I call it inside the start function, and it works but when changing scenes with the same character the UCC jump gets crazy (similar to when instantiating an AC character), any ideas how to solve that ?

  • What do you mean by "gets crazy"? Is it that the camera is moving erratically?

    After a scene-change, AC will teleport the Player to the correct PlayerStart - it may be that the camera similarly needs to be "snapped" to the Player at this moment.

    If this is so, you can create a new script that hooks into the OnOccupyPlayerStart custom event, which is fired when this occurs, and use it to update the camera's position. How exactly this occurs will be down to UCC - you should contact them for advice regarding this.

    private void OnEnable () { EventManager.OnOccupyPlayerStart += OnOccupyPlayerStart; }
    private void OnDisable () { EventManager.OnOccupyPlayerStart -= OnOccupyPlayerStart; }
    
    private void OnOccupyPlayerStart (Player player, PlayerStart playerStart)
    {
        if (player == KickStarter.player)
        {
            // Active Player was teleported to a PlayerStart
        }
    }
    
  • edited May 2021

    Sorry for being so unspecific, what I meant is that the character seems to have added horizontal force when jumping (super long jumps).
    This doesn't happen when changing characters from scene to scene or changing characters inside a scene.

    The current setup I'm using now is putting this script on the UCC camera and calling it from Start:
    public void SetCharacter() { controlCam = FindObjectOfType<CameraController>(); controlCam.Character = KickStarter.player.gameObject; }

    And basically the same script on AC_UCC_Character that calls it from the onEnable function.

    I'll ask Opsive on the best practices for don't destroy on load player characters.

  • edited May 2021

    Removed Comment

  • The player's jumping direction may factor in the facing direction of the camera, but that would be for Opsive to confirm.

    Could it be that jump direction is being influenced by AC's MainCamera, rather than the UCC camera?

  • I gave up, I ended up going the way I was doing before, no player switching allowed, Player in scene, different scenes per characters, and controlling states with AC.

    In case someone finds these useful these are the actionlists I'm using to give UCC items:

    Equip Weapon:

        using UnityEngine;
        using System.Collections.Generic;
        using Opsive.UltimateCharacterController.Inventory;
    
    
        #if UNITY_EDITOR
        using UnityEditor;
        #endif
    
        namespace AC
        {
            [System.Serializable]
            public class ActionUnequipWeapon : Action
            {
                [Tooltip("The character that should drop the item.")]
                [SerializeField] protected GameObject m_Character;
                [Tooltip("The ItemType that the character should remove.")]
                [SerializeField] protected ItemType m_ItemType;
                [Tooltip("The Slot that the character should Unequip.")]
                [SerializeField] protected int m_SlotID;
                [SerializeField] private bool isPlayer;
                [SerializeField] public bool removeAll;
    
                public ActionUnequipWeapon()
                {
                    this.isDisplayed = true;
                    category = ActionCategory.Custom;
                    title = "Unequip Weapon";
                    description = "Unequip a weapon added to the itemset";
                }
    
    
                public override float Run ()
                {
                    if (isPlayer)
                    {
                        m_Character = AC.KickStarter.player.gameObject;
                    }
                    var inventory = m_Character.GetComponent<InventoryBase>();
    
                    // A single ItemType can exist in multiple slots. Drop all of the items.
    
                    if (removeAll)
                    {
                        inventory.UnequipItem(m_SlotID);
                        inventory.RemoveAllItems(false);
                    }
                    else
                        for (int i = 0; i < inventory.SlotCount; ++i)
                        {
                            var item = inventory.GetItem(m_ItemType, i);
                            if (item != null)
                            {
                                inventory.RemoveItem(m_ItemType, i, 1, false);
                                //inventory.UnequipItem(m_SlotID);
                            }
                        }
    
                    if (!isRunning)
                    {
                        isRunning = true;
                        return defaultPauseTime;
                    }
                    else
                    {
                        isRunning = false;
                        return 0f;
                    }
                }
    
    
                public override void Skip ()
                {
                     Run ();
                }
    
    
                #if UNITY_EDITOR
    
                public override void ShowGUI ()
                {
                    isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer);
                    if (!isPlayer)
                        m_Character = (GameObject)EditorGUILayout.ObjectField("Character:", m_Character, typeof(GameObject), true);
                    removeAll = EditorGUILayout.Toggle("Remove All Items?", removeAll);
                    if (!removeAll)
                        m_ItemType = (ItemType)EditorGUILayout.ObjectField("Item Type to remove", m_ItemType, typeof(ItemType), true);
                    m_SlotID = (int)EditorGUILayout.IntField("Slot ID:", m_SlotID);
    
                    AfterRunningOption();
                }
    
    
                public override string SetLabel ()
                {
                    return string.Empty;
                }
        #endif
            }
        }
    

    Unequip Weapon:

        using UnityEngine;
        using System.Collections.Generic;
        using Opsive.UltimateCharacterController.Inventory;
    
        #if UNITY_EDITOR
        using UnityEditor;
        #endif
    
        namespace AC
        {
            [System.Serializable]
            public class ActionEquipWeapon : Action
            {
    
                [SerializeField] protected GameObject m_Character;
                [SerializeField] protected ItemType m_ItemType;
                [SerializeField] protected int m_Amount = 1;
                [SerializeField] bool isPlayer;
    
                public ActionEquipWeapon()
                {
                    this.isDisplayed = true;
                    category = ActionCategory.Custom;
                    title = "Equip Weapon";
                    description = "Equip a weapon added to the itemset";
                }
    
    
                public override float Run ()
                {
                    if (isPlayer)
                    {
                        m_Character = AC.KickStarter.player.gameObject;
                    }
                    var inventory = m_Character.GetComponent<InventoryBase>();
    
                    if (!isRunning)
                    {
                        isRunning = true;
                        return defaultPauseTime;
                    }
                    else
                    {
                        isRunning = false;
                        return 0f;
                    }
                }
    
    
                public override void Skip ()
                {
                     Run ();
                }
    
    
                #if UNITY_EDITOR
    
                public override void ShowGUI ()
                {
                    // Action-specific Inspector GUI code here
                    isPlayer = EditorGUILayout.Toggle("Is Player?", isPlayer);
                    if (!isPlayer)
                        m_Character = (GameObject)EditorGUILayout.ObjectField("Character:", m_Character, typeof(GameObject), true);
    
                    m_ItemType = (ItemType)EditorGUILayout.ObjectField("Item Type", m_ItemType, typeof(ItemType), true);
                    AfterRunningOption();
                }
    
    
                public override string SetLabel ()
                {
                    return string.Empty;
                }
        #endif
            }
        }
    
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.