initial upload
This commit is contained in:
BIN
Unity-Master/Assets/Plugins/RootMotion/FinalIK/_DEMOS/Rotation Limits/Rotation Limits.unity
(Stored with Git LFS)
Normal file
BIN
Unity-Master/Assets/Plugins/RootMotion/FinalIK/_DEMOS/Rotation Limits/Rotation Limits.unity
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b8026c3c09aa423aac7dc8017e58e86
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9b5d4a6e6da554dfd89a76e257421fb2
|
||||
folderAsset: yes
|
||||
timeCreated: 1434626795
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -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:
|
||||
BIN
Unity-Master/Assets/Plugins/RootMotion/FinalIK/_DEMOS/Rotation Limits/Turret.unity
(Stored with Git LFS)
Normal file
BIN
Unity-Master/Assets/Plugins/RootMotion/FinalIK/_DEMOS/Rotation Limits/Turret.unity
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3331caf4c834342f083a159e5ab50603
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user