Fandom

Adventure Creator Wikia

FinalIK Interactions Integration (AC Action)

37pages on
this wiki
Add New Page
Comments0 Share

Note: This AC action is meant to allow the usage of the "Interaction" features in FinalIK through AC's visual scripting. To use it replace the text in a .cs file named FinalIK_RunInteraction with this text, or create a new blank text file, then paste the text and rename the file FinalIK_RunInteraction.cs. Then drop the file into the folder named actions inside the Adventure creator folder.

Quote: in Unity, put the Fully Biped IK and Interaction System scripts on the character, then you are good to go. Go to Custom : Final IK : Run interaction and put the object in the action. And in the object the right affector.
This is the code:

using UnityEngine;
using System.Collections;
using RootMotion.FinalIK;

#if UNITY_EDITOR
using UnityEditor;
#endif
 
 namespace AC
 {
 	[System.Serializable]
 	public class FinalIK_RunInteraction : Action
 	{
 		public bool isPlayer;
 		public InteractionSystem interactionSystem;
 		public FullBodyBipedEffector effector;
 		public InteractionObject interactionObject;
 		public bool canInterrupt;
 		
 		public FinalIK_RunInteraction()
 		{
 			this.isDisplayed = true;
 			category = ActionCategory.Custom;
 			title = "Final IK - Run interaction";
 			description = "Starts an interaction using the Final IK Interaction System";
 			isPlayer = true;
 			canInterrupt = true;
 		}
 		
 		override public float Run()
 		{
 			if (isPlayer)
 			{
 				interactionSystem = KickStarter.player.GetComponent<InteractionSystem>();
 				
 				if (interactionSystem == null)
 				{
 					Debug.LogWarning("FinalIK_RunInteraction: No InteractionSystem found on Player.");
 					return 0f;
 				}
 			}
 			else if (interactionSystem == null)
 			{
 				Debug.LogWarning("FinalIK_RunInteraction: No InteractionSystem defined.");
 				return 0f;
 			}
 			
 			if (interactionObject == null)
 			{
 				Debug.LogWarning("FinalIK_RunInteraction: No InteractionObject defined.");
 				return 0f;
 			}
 			
 			interactionSystem.StartInteraction(effector, interactionObject, canInterrupt);
 			return 0f;
 		}
 
 		override public void Skip(){
 
 
 		
 
 
 		}
 
 
 		
 		#if UNITY_EDITOR
 		override public void ShowGUI()
 		{
 			isPlayer = EditorGUILayout.Toggle("Is player?", isPlayer);
 			
 			if (!isPlayer)
 			{
 				interactionSystem = (InteractionSystem)EditorGUILayout.ObjectField("Character:", interactionSystem, typeof(InteractionSystem), true);
 			}
 			
 			effector = (FullBodyBipedEffector)EditorGUILayout.EnumPopup("Effector:", effector);
 			
 			interactionObject = (InteractionObject)EditorGUILayout.ObjectField("Interaction object:", interactionObject, typeof(InteractionObject), true);
 			canInterrupt = EditorGUILayout.Toggle("Can interrupt?", canInterrupt);
 			AfterRunningOption();
 		}
 		#endif
 	}
 }

-Code provided by Snebjorn and edited by PurpleShine-

-Quotes edited by Alverik-

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki