Added FinalIK

This commit is contained in:
2026-08-12 16:46:38 +03:00
parent 487e0d72ff
commit 1dc80339d4
1124 changed files with 768831 additions and 139 deletions
@@ -0,0 +1,45 @@
using UnityEngine;
using System.Collections;
using RootMotion;
using RootMotion.FinalIK;
namespace RootMotion.Demos {
/// <summary>
/// Demo for aiming a Turret. All it does is call Transform.LookAt on each part and apply rotation limits one by one, starting from the parent.
/// </summary>
public class Turret : MonoBehaviour {
/// <summary>
/// An independent part of the turret
/// </summary>
[System.Serializable]
public class Part {
public Transform transform; // The Transform
private RotationLimit rotationLimit; // The Rotation Limit component
// Aim this part at the target
public void AimAt(Transform target) {
transform.LookAt(target.position, transform.up);
// Finding the Rotation Limit
if (rotationLimit == null) {
rotationLimit = transform.GetComponent<RotationLimit>();
rotationLimit.Disable();
}
// Apply rotation limits
rotationLimit.Apply();
}
}
public Transform target; // The aiming target
public Part[] parts; // All the turret parts
void Update() {
// Rotate the turret parts one by one
foreach (Part part in parts) part.AimAt(target);
}
}
}
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 287e53df824774c4dbfc71e796a515f5
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: