initial upload

This commit is contained in:
tom.hempel
2025-09-21 22:42:26 +02:00
commit d03bcd4ba5
6231 changed files with 351582 additions and 0 deletions

View File

@ -0,0 +1,53 @@
using UnityEngine;
using System.Collections;
namespace RootMotion.FinalIK {
/// <summary>
/// Aim %IK solver component.
/// </summary>
[HelpURL("https://www.youtube.com/watch?v=wT8fViZpLmQ&index=3&list=PLVxSIA1OaTOu8Nos3CalXbJ2DrKnntMv6")]
[AddComponentMenu("Scripts/RootMotion.FinalIK/IK/Aim IK")]
public class AimIK : IK {
// Open the User Manual URL
[ContextMenu("User Manual")]
protected override void OpenUserManual() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/page1.html");
}
// Open the Script Reference URL
[ContextMenu("Scrpt Reference")]
protected override void OpenScriptReference() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_aim_i_k.html");
}
// Open a video tutorial about setting up the component
[ContextMenu("TUTORIAL VIDEO")]
void OpenSetupTutorial() {
Application.OpenURL("https://www.youtube.com/watch?v=wT8fViZpLmQ");
}
// Link to the Final IK Google Group
[ContextMenu("Support Group")]
void SupportGroup() {
Application.OpenURL("https://groups.google.com/forum/#!forum/final-ik");
}
// Link to the Final IK Asset Store thread in the Unity Community
[ContextMenu("Asset Store Thread")]
void ASThread() {
Application.OpenURL("http://forum.unity3d.com/threads/final-ik-full-body-ik-aim-look-at-fabrik-ccd-ik-1-0-released.222685/");
}
/// <summary>
/// The Aim %IK solver.
/// </summary>
public IKSolverAim solver = new IKSolverAim();
public override IKSolver GetIKSolver() {
return solver as IKSolver;
}
}
}

View File

@ -0,0 +1,17 @@
fileFormatVersion: 2
guid: 5013856973b27429d937d256dc082f2e
labels:
- InverseKinematics
- IK
- Aim
- AimingSystem
timeCreated: 1511881277
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 9997
icon: {fileID: 2800000, guid: 14a4d69b319a04b75bb03f351a174cec, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using UnityEngine;
using System.Collections;
namespace RootMotion.FinalIK {
/// <summary>
/// Arm %IK solver component.
/// </summary>
[HelpURL("http://www.root-motion.com/finalikdox/html/page2.html")]
[AddComponentMenu("Scripts/RootMotion.FinalIK/IK/Arm IK")]
public class ArmIK : IK {
// Open the User Manual URL
[ContextMenu("User Manual")]
protected override void OpenUserManual() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/page2.html");
}
// Open the Script Reference URL
[ContextMenu("Scrpt Reference")]
protected override void OpenScriptReference() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_arm_i_k.html");
}
// Link to the Final IK Google Group
[ContextMenu("Support Group")]
void SupportGroup() {
Application.OpenURL("https://groups.google.com/forum/#!forum/final-ik");
}
// Link to the Final IK Asset Store thread in the Unity Community
[ContextMenu("Asset Store Thread")]
void ASThread() {
Application.OpenURL("http://forum.unity3d.com/threads/final-ik-full-body-ik-aim-look-at-fabrik-ccd-ik-1-0-released.222685/");
}
/// <summary>
/// The Arm %IK solver.
/// </summary>
public IKSolverArm solver = new IKSolverArm();
public override IKSolver GetIKSolver() {
return solver as IKSolver;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5d9643e11c77c0d4fb27fbcf6ff4839c
timeCreated: 1528379801
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 9997
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using UnityEngine;
using System.Collections;
namespace RootMotion.FinalIK {
/// <summary>
/// CCD (Cyclic Coordinate Descent) %IK solver component.
/// </summary>
[HelpURL("http://www.root-motion.com/finalikdox/html/page5.html")]
[AddComponentMenu("Scripts/RootMotion.FinalIK/IK/CCD IK")]
public class CCDIK : IK {
// Open the User Manual URL
[ContextMenu("User Manual")]
protected override void OpenUserManual() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/page5.html");
}
// Open the Script Reference URL
[ContextMenu("Scrpt Reference")]
protected override void OpenScriptReference() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_c_c_d_i_k.html");
}
// Link to the Final IK Google Group
[ContextMenu("Support Group")]
void SupportGroup() {
Application.OpenURL("https://groups.google.com/forum/#!forum/final-ik");
}
// Link to the Final IK Asset Store thread in the Unity Community
[ContextMenu("Asset Store Thread")]
void ASThread() {
Application.OpenURL("http://forum.unity3d.com/threads/final-ik-full-body-ik-aim-look-at-fabrik-ccd-ik-1-0-released.222685/");
}
/// <summary>
/// The CCD %IK solver.
/// </summary>
public IKSolverCCD solver = new IKSolverCCD();
public override IKSolver GetIKSolver() {
return solver as IKSolver;
}
}
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 98b9a1a9e9a934b23a7db351dd9ec69e
labels:
- InverseKinematics
- IK
- CCD
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 9997
icon: {fileID: 2800000, guid: 79450243724744b44820e5468e418048, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,47 @@
using UnityEngine;
using System.Collections;
namespace RootMotion.FinalIK {
/// <summary>
/// Forward and Backward Reaching %IK solver component.
/// </summary>
[HelpURL("http://www.root-motion.com/finalikdox/html/page6.html")]
[AddComponentMenu("Scripts/RootMotion.FinalIK/IK/FABRIK")]
public class FABRIK : IK {
// Open the User Manual URL
[ContextMenu("User Manual")]
protected override void OpenUserManual() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/page6.html");
}
// Open the Script Reference URL
[ContextMenu("Scrpt Reference")]
protected override void OpenScriptReference() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_f_a_b_r_i_k.html");
}
// Link to the Final IK Google Group
[ContextMenu("Support Group")]
void SupportGroup() {
Application.OpenURL("https://groups.google.com/forum/#!forum/final-ik");
}
// Link to the Final IK Asset Store thread in the Unity Community
[ContextMenu("Asset Store Thread")]
void ASThread() {
Application.OpenURL("http://forum.unity3d.com/threads/final-ik-full-body-ik-aim-look-at-fabrik-ccd-ik-1-0-released.222685/");
}
/// <summary>
/// The %FABRIK solver.
/// </summary>
public IKSolverFABRIK solver = new IKSolverFABRIK();
public override IKSolver GetIKSolver() {
return solver as IKSolver;
}
}
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 52af154b35b9e48af96507346dc649ba
labels:
- InverseKinematics
- IK
- FABRIK
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 9997
icon: {fileID: 2800000, guid: 1ccc9218a62cd44dda0ddb5fa15c62cc, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using UnityEngine;
using System.Collections;
namespace RootMotion.FinalIK {
/// <summary>
/// %IK system for multiple branched %FABRIK chains.
/// </summary>
[HelpURL("http://www.root-motion.com/finalikdox/html/page7.html")]
[AddComponentMenu("Scripts/RootMotion.FinalIK/IK/FABRIK Root")]
public class FABRIKRoot : IK {
// Open the User Manual URL
[ContextMenu("User Manual")]
protected override void OpenUserManual() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/page7.html");
}
// Open the Script Reference URL
[ContextMenu("Scrpt Reference")]
protected override void OpenScriptReference() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_f_a_b_r_i_k_root.html");
}
// Link to the Final IK Google Group
[ContextMenu("Support Group")]
void SupportGroup() {
Application.OpenURL("https://groups.google.com/forum/#!forum/final-ik");
}
// Link to the Final IK Asset Store thread in the Unity Community
[ContextMenu("Asset Store Thread")]
void ASThread() {
Application.OpenURL("http://forum.unity3d.com/threads/final-ik-full-body-ik-aim-look-at-fabrik-ccd-ik-1-0-released.222685/");
}
/// <summary>
/// The %FABRIKRoot solver.
/// </summary>
public IKSolverFABRIKRoot solver = new IKSolverFABRIKRoot();
public override IKSolver GetIKSolver() {
return solver as IKSolver;
}
}
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 6fb82f19cc3ce412892b525300de1141
labels:
- InverseKinematics
- IK
- FABRIK
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 9997
icon: {fileID: 2800000, guid: 55f7720fb239042f08656d4ab294f5c5, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,160 @@
using UnityEngine;
using System.Collections;
namespace RootMotion.FinalIK {
/// <summary>
/// Full Body %IK System designed specifically for bipeds
/// </summary>
[HelpURL("https://www.youtube.com/watch?v=7__IafZGwvI&index=1&list=PLVxSIA1OaTOu8Nos3CalXbJ2DrKnntMv6")]
[AddComponentMenu("Scripts/RootMotion.FinalIK/IK/Full Body Biped IK")]
public class FullBodyBipedIK : IK {
// Open the User Manual URL
[ContextMenu("User Manual")]
protected override void OpenUserManual() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/page8.html");
}
// Open the Script Reference URL
[ContextMenu("Scrpt Reference")]
protected override void OpenScriptReference() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_full_body_biped_i_k.html");
}
// Open a video tutorial about setting up the component
[ContextMenu("TUTORIAL VIDEO (SETUP)")]
void OpenSetupTutorial() {
Application.OpenURL("https://www.youtube.com/watch?v=7__IafZGwvI");
}
// Open a video tutorial about the component's inspector.
[ContextMenu("TUTORIAL VIDEO (INSPECTOR)")]
void OpenInspectorTutorial() {
Application.OpenURL("https://www.youtube.com/watch?v=tgRMsTphjJo");
}
// Link to the Final IK Google Group
[ContextMenu("Support Group")]
void SupportGroup() {
Application.OpenURL("https://groups.google.com/forum/#!forum/final-ik");
}
// Link to the Final IK Asset Store thread in the Unity Community
[ContextMenu("Asset Store Thread")]
void ASThread() {
Application.OpenURL("http://forum.unity3d.com/threads/final-ik-full-body-ik-aim-look-at-fabrik-ccd-ik-1-0-released.222685/");
}
/// <summary>
/// The biped definition. Don't change refences directly in runtime, use SetReferences(BipedReferences references) instead.
/// </summary>
public BipedReferences references = new BipedReferences();
/// <summary>
/// The FullBodyBiped %IK solver.
/// </summary>
public IKSolverFullBodyBiped solver = new IKSolverFullBodyBiped();
/// <summary>
/// Sets the solver to new biped references.
/// </summary>
/// /// <param name="references">Biped references.</param>
/// <param name="rootNode">Root node. if null, will try to detect the root node bone automatically. </param>
public void SetReferences(BipedReferences references, Transform rootNode) {
this.references = references;
solver.SetToReferences(this.references, rootNode);
}
public override IKSolver GetIKSolver() {
return solver as IKSolver;
}
/// <summary>
/// Checks the biped references for errors. Returns true if error found.
/// </summary>
public bool ReferencesError(ref string errorMessage) {
// All the errors common to all bipeds
if (BipedReferences.SetupError(references, ref errorMessage)) return true;
// All the errors specific to FBBIK
if (references.spine.Length == 0) {
errorMessage = "References has no spine bones assigned, can not initiate the solver.";
return true;
}
if (solver.rootNode == null) {
errorMessage = "Root Node bone is null, can not initiate the solver.";
return true;
}
if (solver.rootNode != references.pelvis) {
bool inSpine = false;
for (int i = 0; i < references.spine.Length; i++) {
if (solver.rootNode == references.spine[i]) {
inSpine = true;
break;
}
}
if (!inSpine) {
errorMessage = "The Root Node has to be one of the bones in the Spine or the Pelvis, can not initiate the solver.";
return true;
}
}
return false;
}
/// <summary>
/// Check for possible warnings with the biped references setup. Returns true if warning found. The solver can still run, but probably not how you expected.
/// </summary>
public bool ReferencesWarning(ref string warningMessage) {
// Check for all the warnings common to all bipeds
if (BipedReferences.SetupWarning(references, ref warningMessage)) return true;
// Check for warnings specific to FBBIK
Vector3 toRightShoulder = references.rightUpperArm.position - references.leftUpperArm.position;
Vector3 shoulderToRootNode = solver.rootNode.position - references.leftUpperArm.position;
float dot = Vector3.Dot(toRightShoulder.normalized, shoulderToRootNode.normalized);
if (dot > 0.95f) {
warningMessage = "The root node, the left upper arm and the right upper arm bones should ideally form a triangle that is as close to equilateral as possible. " +
"Currently the root node bone seems to be very close to the line between the left upper arm and the right upper arm bones. This might cause unwanted behaviour like the spine turning upside down when pulled by a hand effector." +
"Please set the root node bone to be one of the lower bones in the spine.";
return true;
}
Vector3 toRightThigh = references.rightThigh.position - references.leftThigh.position;
Vector3 thighToRootNode = solver.rootNode.position - references.leftThigh.position;
dot = Vector3.Dot(toRightThigh.normalized, thighToRootNode.normalized);
if (dot > 0.95f) {
warningMessage = "The root node, the left thigh and the right thigh bones should ideally form a triangle that is as close to equilateral as possible. " +
"Currently the root node bone seems to be very close to the line between the left thigh and the right thigh bones. This might cause unwanted behaviour like the hip turning upside down when pulled by an effector." +
"Please set the root node bone to be one of the higher bones in the spine.";
return true;
}
return false;
}
// Reinitiates the solver to the current references
[ContextMenu("Reinitiate")]
void Reinitiate() {
SetReferences(references, solver.rootNode);
}
// Open the User Manual URL
[ContextMenu("Auto-detect References")]
void AutoDetectReferences() {
references = new BipedReferences();
BipedReferences.AutoDetectReferences(ref references, transform, new BipedReferences.AutoDetectParams(true, false));
solver.rootNode = IKSolverFullBodyBiped.DetectRootNodeBone(references);
solver.SetToReferences(references, solver.rootNode);
}
}
}

View File

@ -0,0 +1,16 @@
fileFormatVersion: 2
guid: a70e525c82ce9413fa4d940ad7fcf1db
labels:
- InverseKinematics
- IK
- FullBodyIK
timeCreated: 1519038538
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 9999
icon: {fileID: 2800000, guid: 89e0c79ada10847639ab1754e12413a7, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,50 @@
using UnityEngine;
using System.Collections;
namespace RootMotion.FinalIK {
/// <summary>
/// Base abstract class for %IK solver components.
/// </summary>
public abstract class IK: SolverManager {
#region Main Interface
/// <summary>
/// Gets the %IK component's solver as IKSolver.
/// </summary>
public abstract IKSolver GetIKSolver();
#endregion Main Interface
/*
* Updates the solver. If you need full control of the execution order of your IK solvers, disable this script and call UpdateSolver() instead.
* */
protected override void UpdateSolver() {
if (!GetIKSolver().initiated) InitiateSolver();
if (!GetIKSolver().initiated) return;
GetIKSolver().Update();
}
/*
* Initiates the %IK solver
* */
protected override void InitiateSolver() {
if (GetIKSolver().initiated) return;
GetIKSolver().Initiate(transform);
}
protected override void FixTransforms() {
if (!GetIKSolver().initiated) return;
GetIKSolver().FixTransforms();
}
// Open the User Manual url
protected abstract void OpenUserManual();
// Open the Script Reference url
protected abstract void OpenScriptReference();
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: e8ad84abaddc346b9a51365d3dc292e7
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,68 @@
using UnityEngine;
using System.Collections;
namespace RootMotion.FinalIK {
/// <summary>
/// Manages the execution order of IK components.
/// </summary>
public class IKExecutionOrder : MonoBehaviour {
/// <summary>
/// The IK components, assign in the order in which you wish to update them.
/// </summary>
[Tooltip("The IK components, assign in the order in which you wish to update them.")]
public IK[] IKComponents;
[Tooltip("Optional. Assign it if you are using 'Animate Physics' as the Update Mode.")]
/// <summary>
/// Optional. Assign it if you are using 'Animate Physics' as the Update Mode.
/// </summary>
public Animator animator;
private bool fixedFrame;
private bool animatePhysics {
get {
if (animator == null) return false;
return animator.updateMode == AnimatorUpdateMode.AnimatePhysics;
}
}
// Disable the IK components
void Start() {
for (int i = 0; i < IKComponents.Length; i++) IKComponents[i].enabled = false;
}
// Fix Transforms in Normal update mode
void Update() {
if (animatePhysics) return;
FixTransforms ();
}
// Fix Transforms in Animate Physics update mode
void FixedUpdate() {
fixedFrame = true;
if (animatePhysics) FixTransforms ();
}
// Update the IK components in a specific order
void LateUpdate() {
if (!animatePhysics || fixedFrame) {
for (int i = 0; i < IKComponents.Length; i++) {
IKComponents [i].GetIKSolver ().Update ();
}
fixedFrame = false;
}
}
private void FixTransforms() {
for (int i = 0; i < IKComponents.Length; i++) {
if (IKComponents[i].fixTransforms) IKComponents[i].GetIKSolver().FixTransforms();
}
}
}
}

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 36737232c1e1646399fa0c8cbc087280
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 9996
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using UnityEngine;
using System.Collections;
namespace RootMotion.FinalIK {
/// <summary>
/// Leg %IK solver component.
/// </summary>
[HelpURL("http://www.root-motion.com/finalikdox/html/page11.html")]
[AddComponentMenu("Scripts/RootMotion.FinalIK/IK/Leg IK")]
public class LegIK : IK {
// Open the User Manual URL
[ContextMenu("User Manual")]
protected override void OpenUserManual() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/page11.html");
}
// Open the Script Reference URL
[ContextMenu("Scrpt Reference")]
protected override void OpenScriptReference() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_leg_i_k.html");
}
// Link to the Final IK Google Group
[ContextMenu("Support Group")]
void SupportGroup() {
Application.OpenURL("https://groups.google.com/forum/#!forum/final-ik");
}
// Link to the Final IK Asset Store thread in the Unity Community
[ContextMenu("Asset Store Thread")]
void ASThread() {
Application.OpenURL("http://forum.unity3d.com/threads/final-ik-full-body-ik-aim-look-at-fabrik-ccd-ik-1-0-released.222685/");
}
/// <summary>
/// The Leg %IK solver.
/// </summary>
public IKSolverLeg solver = new IKSolverLeg();
public override IKSolver GetIKSolver() {
return solver as IKSolver;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d45baccdcad47264da4758094969d5d5
timeCreated: 1487060958
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 9997
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using UnityEngine;
using System.Collections;
namespace RootMotion.FinalIK {
/// <summary>
/// %IK component for IKSolverLimb.
/// </summary>
[HelpURL("http://www.root-motion.com/finalikdox/html/page12.html")]
[AddComponentMenu("Scripts/RootMotion.FinalIK/IK/Limb IK")]
public class LimbIK : IK {
// Open the User Manual URL
[ContextMenu("User Manual")]
protected override void OpenUserManual() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/page12.html");
}
// Open the Script Reference URL
[ContextMenu("Scrpt Reference")]
protected override void OpenScriptReference() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_limb_i_k.html");
}
// Link to the Final IK Google Group
[ContextMenu("Support Group")]
void SupportGroup() {
Application.OpenURL("https://groups.google.com/forum/#!forum/final-ik");
}
// Link to the Final IK Asset Store thread in the Unity Community
[ContextMenu("Asset Store Thread")]
void ASThread() {
Application.OpenURL("http://forum.unity3d.com/threads/final-ik-full-body-ik-aim-look-at-fabrik-ccd-ik-1-0-released.222685/");
}
/// <summary>
/// The Limb %IK solver.
/// </summary>
public IKSolverLimb solver = new IKSolverLimb();
public override IKSolver GetIKSolver() {
return solver as IKSolver;
}
}
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 4db3c450680fd4c809d5ad90a2f24e5f
labels:
- InverseKinematics
- IK
- LimbIK
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 9997
icon: {fileID: 2800000, guid: e747b4712fd43444ab8213b7ff4c089b, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using UnityEngine;
using System.Collections;
namespace RootMotion.FinalIK {
/// <summary>
/// Rotates a hierarchy of bones to face a target
/// </summary>
[HelpURL("http://www.root-motion.com/finalikdox/html/page13.html")]
[AddComponentMenu("Scripts/RootMotion.FinalIK/IK/Look At IK")]
public class LookAtIK : IK {
// Open the User Manual URL
[ContextMenu("User Manual")]
protected override void OpenUserManual() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/page13.html");
}
// Open the Script Reference URL
[ContextMenu("Scrpt Reference")]
protected override void OpenScriptReference() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_look_at_i_k.html");
}
// Link to the Final IK Google Group
[ContextMenu("Support Group")]
void SupportGroup() {
Application.OpenURL("https://groups.google.com/forum/#!forum/final-ik");
}
// Link to the Final IK Asset Store thread in the Unity Community
[ContextMenu("Asset Store Thread")]
void ASThread() {
Application.OpenURL("http://forum.unity3d.com/threads/final-ik-full-body-ik-aim-look-at-fabrik-ccd-ik-1-0-released.222685/");
}
/// <summary>
/// The LookAt %IK solver.
/// </summary>
public IKSolverLookAt solver = new IKSolverLookAt();
public override IKSolver GetIKSolver() {
return solver as IKSolver;
}
}
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 776adaaacdc5c4e8ab0395120a6e972b
labels:
- InverseKinematics
- IK
- LookAtIK
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 9997
icon: {fileID: 2800000, guid: dc3f34dec09f54c4d8a48bf1a653b179, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using UnityEngine;
using System.Collections;
namespace RootMotion.FinalIK {
/// <summary>
/// Analytic %IK algorithm based on the law of cosines
/// </summary>
[HelpURL("http://www.root-motion.com/finalikdox/html/page15.html")]
[AddComponentMenu("Scripts/RootMotion.FinalIK/IK/Trigonometric IK")]
public class TrigonometricIK : IK {
// Open the User Manual URL
[ContextMenu("User Manual")]
protected override void OpenUserManual() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/page15.html");
}
// Open the Script Reference URL
[ContextMenu("Scrpt Reference")]
protected override void OpenScriptReference() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_trigonometric_i_k.html");
}
// Link to the Final IK Google Group
[ContextMenu("Support Group")]
void SupportGroup() {
Application.OpenURL("https://groups.google.com/forum/#!forum/final-ik");
}
// Link to the Final IK Asset Store thread in the Unity Community
[ContextMenu("Asset Store Thread")]
void ASThread() {
Application.OpenURL("http://forum.unity3d.com/threads/final-ik-full-body-ik-aim-look-at-fabrik-ccd-ik-1-0-released.222685/");
}
/// <summary>
/// The Trigonometric %IK solver.
/// </summary>
public IKSolverTrigonometric solver = new IKSolverTrigonometric();
public override IKSolver GetIKSolver() {
return solver as IKSolver;
}
}
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 76b6217e3524c44358e310a531792c50
labels:
- InverseKinematics
- IK
- LimbIK
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 9997
icon: {fileID: 2800000, guid: ff34b0ecb22e7466fbd0a856b7a00621, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,312 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace RootMotion.FinalIK {
/// <summary>
/// A full-body IK solver designed specifically for a VR HMD and hand controllers.
/// </summary>
//[HelpURL("http://www.root-motion.com/finalikdox/html/page16.html")]
[AddComponentMenu("Scripts/RootMotion.FinalIK/IK/VR IK")]
public class VRIK : IK {
/// <summary>
/// VRIK-specific definition of a humanoid biped.
/// </summary>
[System.Serializable]
public class References {
public Transform root; // 0
[LargeHeader("Spine")]
public Transform pelvis; // 1
public Transform spine; // 2
[Tooltip("Optional")]
public Transform chest; // 3 Optional
[Tooltip("Optional")]
public Transform neck; // 4 Optional
public Transform head; // 5
[LargeHeader("Left Arm")]
[Tooltip("Optional")]
public Transform leftShoulder; // 6 Optional
[Tooltip("VRIK also supports armless characters.If you do not wish to use arms, leave all arm references empty.")]
public Transform leftUpperArm; // 7
[Tooltip("VRIK also supports armless characters.If you do not wish to use arms, leave all arm references empty.")]
public Transform leftForearm; // 8
[Tooltip("VRIK also supports armless characters.If you do not wish to use arms, leave all arm references empty.")]
public Transform leftHand; // 9
[LargeHeader("Right Arm")]
[Tooltip("Optional")]
public Transform rightShoulder; // 10 Optional
[Tooltip("VRIK also supports armless characters.If you do not wish to use arms, leave all arm references empty.")]
public Transform rightUpperArm; // 11
[Tooltip("VRIK also supports armless characters.If you do not wish to use arms, leave all arm references empty.")]
public Transform rightForearm; // 12
[Tooltip("VRIK also supports armless characters.If you do not wish to use arms, leave all arm references empty.")]
public Transform rightHand; // 13
[LargeHeader("Left Leg")]
[Tooltip("VRIK also supports legless characters.If you do not wish to use legs, leave all leg references empty.")]
public Transform leftThigh; // 14 Optional
[Tooltip("VRIK also supports legless characters.If you do not wish to use legs, leave all leg references empty.")]
public Transform leftCalf; // 15 Optional
[Tooltip("VRIK also supports legless characters.If you do not wish to use legs, leave all leg references empty.")]
public Transform leftFoot; // 16 Optional
[Tooltip("Optional")]
public Transform leftToes; // 17 Optional
[LargeHeader("Right Leg")]
[Tooltip("VRIK also supports legless characters.If you do not wish to use legs, leave all leg references empty.")]
public Transform rightThigh; // 18 Optional
[Tooltip("VRIK also supports legless characters.If you do not wish to use legs, leave all leg references empty.")]
public Transform rightCalf; // 19 Optional
[Tooltip("VRIK also supports legless characters.If you do not wish to use legs, leave all leg references empty.")]
public Transform rightFoot; // 20 Optional
[Tooltip("Optional")]
public Transform rightToes; // 21 Optional
public References() { }
public References(BipedReferences b)
{
root = b.root;
pelvis = b.pelvis;
spine = b.spine[0];
chest = b.spine.Length > 1? b.spine[1]: null;
head = b.head;
leftShoulder = b.leftUpperArm.parent;
leftUpperArm = b.leftUpperArm;
leftForearm = b.leftForearm;
leftHand = b.leftHand;
rightShoulder = b.rightUpperArm.parent;
rightUpperArm = b.rightUpperArm;
rightForearm = b.rightForearm;
rightHand = b.rightHand;
leftThigh = b.leftThigh;
leftCalf = b.leftCalf;
leftFoot = b.leftFoot;
leftToes = b.leftFoot.GetChild(0);
rightThigh = b.rightThigh;
rightCalf = b.rightCalf;
rightFoot = b.rightFoot;
rightToes = b.rightFoot.GetChild(0);
}
/// <summary>
/// Returns an array of all the Transforms in the definition.
/// </summary>
public Transform[] GetTransforms() {
return new Transform[22] {
root, pelvis, spine, chest, neck, head, leftShoulder, leftUpperArm, leftForearm, leftHand, rightShoulder, rightUpperArm, rightForearm, rightHand, leftThigh, leftCalf, leftFoot, leftToes, rightThigh, rightCalf, rightFoot, rightToes
};
}
/// <summary>
/// Returns true if all required Transforms have been assigned (shoulder, toe and neck bones are optional).
/// </summary>
public bool isFilled {
get {
if (
root == null ||
pelvis == null ||
spine == null ||
head == null
) return false;
bool noArmBones =
leftUpperArm == null &&
leftForearm == null &&
leftHand == null &&
rightUpperArm == null &&
rightForearm == null &&
rightHand == null;
bool atLeastOneArmBoneMissing =
leftUpperArm == null ||
leftForearm == null ||
leftHand == null ||
rightUpperArm == null ||
rightForearm == null ||
rightHand == null;
// If all leg bones are null, it is valid
bool noLegBones =
leftThigh == null &&
leftCalf == null &&
leftFoot == null &&
rightThigh == null &&
rightCalf == null &&
rightFoot == null;
bool atLeastOneLegBoneMissing =
leftThigh == null ||
leftCalf == null ||
leftFoot == null ||
rightThigh == null ||
rightCalf == null ||
rightFoot == null;
if (atLeastOneLegBoneMissing && !noLegBones) return false;
if (atLeastOneArmBoneMissing && !noArmBones) return false;
// Shoulder, toe and neck bones are optional
return true;
}
}
/// <summary>
/// Returns true if none of the Transforms have been assigned.
/// </summary>
public bool isEmpty {
get {
if (
root != null ||
pelvis != null ||
spine != null ||
chest != null ||
neck != null ||
head != null ||
leftShoulder != null ||
leftUpperArm != null ||
leftForearm != null ||
leftHand != null ||
rightShoulder != null ||
rightUpperArm != null ||
rightForearm != null ||
rightHand != null ||
leftThigh != null ||
leftCalf != null ||
leftFoot != null ||
leftToes != null ||
rightThigh != null ||
rightCalf != null ||
rightFoot != null ||
rightToes != null
) return false;
return true;
}
}
/// <summary>
/// Auto-detects VRIK references. Works with a Humanoid Animator on the root gameobject only.
/// </summary>
public static bool AutoDetectReferences(Transform root, out References references) {
references = new References();
var animator = root.GetComponentInChildren<Animator>();
if (animator == null || !animator.isHuman) {
Debug.LogWarning("VRIK needs a Humanoid Animator to auto-detect biped references. Please assign references manually.");
return false;
}
references.root = root;
references.pelvis = animator.GetBoneTransform(HumanBodyBones.Hips);
references.spine = animator.GetBoneTransform(HumanBodyBones.Spine);
references.chest = animator.GetBoneTransform(HumanBodyBones.Chest);
references.neck = animator.GetBoneTransform(HumanBodyBones.Neck);
references.head = animator.GetBoneTransform(HumanBodyBones.Head);
references.leftShoulder = animator.GetBoneTransform(HumanBodyBones.LeftShoulder);
references.leftUpperArm = animator.GetBoneTransform(HumanBodyBones.LeftUpperArm);
references.leftForearm = animator.GetBoneTransform(HumanBodyBones.LeftLowerArm);
references.leftHand = animator.GetBoneTransform(HumanBodyBones.LeftHand);
references.rightShoulder = animator.GetBoneTransform(HumanBodyBones.RightShoulder);
references.rightUpperArm = animator.GetBoneTransform(HumanBodyBones.RightUpperArm);
references.rightForearm = animator.GetBoneTransform(HumanBodyBones.RightLowerArm);
references.rightHand = animator.GetBoneTransform(HumanBodyBones.RightHand);
references.leftThigh = animator.GetBoneTransform(HumanBodyBones.LeftUpperLeg);
references.leftCalf = animator.GetBoneTransform(HumanBodyBones.LeftLowerLeg);
references.leftFoot = animator.GetBoneTransform(HumanBodyBones.LeftFoot);
references.leftToes = animator.GetBoneTransform(HumanBodyBones.LeftToes);
references.rightThigh = animator.GetBoneTransform(HumanBodyBones.RightUpperLeg);
references.rightCalf = animator.GetBoneTransform(HumanBodyBones.RightLowerLeg);
references.rightFoot = animator.GetBoneTransform(HumanBodyBones.RightFoot);
references.rightToes = animator.GetBoneTransform(HumanBodyBones.RightToes);
return true;
}
}
// Open the User Manual URL
[ContextMenu("User Manual")]
protected override void OpenUserManual() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/page16.html");
}
// Open the Script Reference URL
[ContextMenu("Scrpt Reference")]
protected override void OpenScriptReference() {
Application.OpenURL("http://www.root-motion.com/finalikdox/html/class_root_motion_1_1_final_i_k_1_1_v_r_i_k.html");
}
// Open a video tutorial about setting up the component
[ContextMenu("TUTORIAL VIDEO (STEAMVR SETUP)")]
void OpenSetupTutorial() {
Application.OpenURL("https://www.youtube.com/watch?v=6Pfx7lYQiIA&feature=youtu.be");
}
/// <summary>
/// Bone mapping. Right-click on the component header and select 'Auto-detect References' of fill in manually if not a Humanoid character. Chest, neck, shoulder and toe bones are optional. VRIK also supports legless characters. If you do not wish to use legs, leave all leg references empty.
/// </summary>
[ContextMenuItem("Auto-detect References", "AutoDetectReferences")]
[Tooltip("Bone mapping. Right-click on the component header and select 'Auto-detect References' of fill in manually if not a Humanoid character. Chest, neck, shoulder and toe bones are optional. VRIK also supports legless characters. If you do not wish to use legs, leave all leg references empty.")]
public References references = new References();
/// <summary>
/// The solver.
/// </summary>
[Tooltip("The VRIK solver.")]
public IKSolverVR solver = new IKSolverVR();
/// <summary>
/// Auto-detects bone references for this VRIK. Works with a Humanoid Animator on the gameobject only.
/// </summary>
[ContextMenu("Auto-detect References")]
public void AutoDetectReferences() {
References.AutoDetectReferences(transform, out references);
}
/// <summary>
/// Fills in arm wristToPalmAxis and palmToThumbAxis.
/// </summary>
[ContextMenu("Guess Hand Orientations")]
public void GuessHandOrientations() {
solver.GuessHandOrientations(references, false);
}
public override IKSolver GetIKSolver() {
return solver as IKSolver;
}
protected override void InitiateSolver() {
if (references.isEmpty) AutoDetectReferences();
if (references.isFilled) solver.SetToReferences(references);
base.InitiateSolver();
}
protected override void UpdateSolver() {
if (references.root != null && references.root.localScale == Vector3.zero) {
Debug.LogError("VRIK Root Transform's scale is zero, can not update VRIK. Make sure you have not calibrated the character to a zero scale.", transform);
enabled = false;
return;
}
base.UpdateSolver();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: bfac4fa329d1f4f23814af71a247c14b
timeCreated: 1461012361
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 9998
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: