Adventure Creator Wikia

Note: This AC action allows you to set and and adjusts the FBBIK body effector.

I've been working to create custom actions that allow for direct access to the FBBIK component through Adventure Creator. So far I've developed one for the Body and another for Limbs. I haven't tested them exhaustively or anything but they appear to actually work.

To use it replace the text in a .cs file named FinalIK_BodyEffector with this text, or create a new blank text file, then paste the text and rename the file FinalIK_BodyEffector.cs. Then drop the file into the folder named actions inside the Adventure creator folder. Then, just use the action in an action list.


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

using UnityEditor;
 namespace AC
 	public class FinalIK_BodyEffector : Action
 		public bool isPlayer;
         public FullBodyBipedIK targetchar;

         //The target Transform (optional, you can use just the position instead)
        public GameObject target;

        //Set the effector position to a point in world space. This has no effect if the effector's positionWeight is 0
        public Vector3 position;

        //Weight of the effector position
        public float positionWeight;

        //If false, child nodes will be ignored
        public bool useThighs;

         //The bend resistance of the spine
        public float spineStiffness;

        //Weight of hand effectors pulling the body vertically
        public float pullBodyVertical;

        //Weight of hand effectors pulling the body horizontally             
        public float pullBodyHorizontal;

        //Spine mapping iteration count
        public int spineMappingIterations;

        //Weight of twisting the spine bones to the chest triangle
        public float spineTwistWeight;

        //The weight of maintaining the bone's animated rotation in world space
        public float maintainHeadRotation;

        public FinalIK_BodyEffector()
			this.isDisplayed = true;
			category = ActionCategory.Custom;
			title = "Final IK - Body Effector";
			description = "Sets and adjusts the FBBIK body effector";
			isPlayer = true;
 		override public float Run()
 			if (isPlayer)
 				targetchar = KickStarter.player.GetComponent<FullBodyBipedIK>();
 				if (targetchar == null)
 					Debug.LogWarning("FinalIK_BodyEffector: No FBBIK component found on Player.");
 					return 0f;
             positionWeight = Mathf.Clamp(positionWeight, 0f, 1f);
            spineMappingIterations = Mathf.Clamp(spineMappingIterations, 1, int.MaxValue);
            spineStiffness = Mathf.Clamp(spineStiffness, 0f, 1f);
            pullBodyVertical = Mathf.Clamp(pullBodyVertical, 0f, 1f);
            pullBodyHorizontal = Mathf.Clamp(pullBodyHorizontal, 0f, 1f);
            maintainHeadRotation = Mathf.Clamp(maintainHeadRotation, 0f, 1f);
            spineTwistWeight = Mathf.Clamp(spineTwistWeight, 0f, 1f);

   = target == null ? null : target.transform;
            targetchar.solver.bodyEffector.position = position;
            targetchar.solver.bodyEffector.positionWeight = positionWeight;
            targetchar.solver.bodyEffector.effectChildNodes = useThighs;
            targetchar.solver.spineMapping.iterations = spineMappingIterations;
            targetchar.solver.spineStiffness = spineStiffness;
            targetchar.solver.pullBodyVertical = pullBodyVertical;
            targetchar.solver.pullBodyHorizontal = pullBodyHorizontal;
            targetchar.solver.spineMapping.twistWeight = spineTwistWeight;
            return 1f;
 		override public void Skip(){       
 		override public void ShowGUI()
 			isPlayer = EditorGUILayout.Toggle("Is player?", isPlayer);
 			if (!isPlayer)
 				targetchar = (FullBodyBipedIK)EditorGUILayout.ObjectField("Character:", targetchar, typeof(FullBodyBipedIK), true);
 			target = (GameObject)EditorGUILayout.ObjectField("Body Effector Target:", target, typeof(GameObject), true);
             position = (Vector3)EditorGUILayout.Vector3Field("Position:", position);
            positionWeight = EditorGUILayout.Slider("Position Weight:", positionWeight, 0f, 1f);
            useThighs = EditorGUILayout.Toggle("Use Thights?", useThighs);
            spineMappingIterations = EditorGUILayout.IntSlider("Spine Iterations:", spineMappingIterations, 0, 3);
            spineStiffness = EditorGUILayout.Slider("Spine Stiffness:", spineStiffness, 0f, 1f);
            pullBodyVertical = EditorGUILayout.Slider("Pull Body Vertical:", pullBodyVertical, 0f, 1f);
            pullBodyHorizontal = EditorGUILayout.Slider("Pull Body Horizontal:", pullBodyHorizontal, 0f, 1f);
            spineTwistWeight = EditorGUILayout.Slider("Spine Twist Weight:", spineTwistWeight, 0f, 1f);


[Script provided by user Larsos]