init
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Animations.Rigging;
|
||||
|
||||
namespace VOID.Generic.Objects.Unit.Animations.Helpers
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
[AddComponentMenu("Animation Rigging/Extract Transform Constraint")]
|
||||
|
||||
public class ExtractTransformConstraint : RigConstraint<
|
||||
ExtractTransformConstraintJob,
|
||||
ExtractTransformConstraintData,
|
||||
ExtractTransformConstraintJobBinder>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5141e0508a048359f47d054e1f893f9
|
||||
timeCreated: 1741290865
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Animations.Rigging;
|
||||
|
||||
namespace VOID.Generic.Objects.Unit.Animations.Helpers
|
||||
{
|
||||
[Serializable]
|
||||
public struct ExtractTransformConstraintData : IAnimationJobData
|
||||
{
|
||||
[SyncSceneToStream] public Transform bone;
|
||||
|
||||
public Vector3 position;
|
||||
public Quaternion rotation;
|
||||
|
||||
public bool IsValid()
|
||||
{
|
||||
return bone != null;
|
||||
}
|
||||
|
||||
public void SetDefaultValues()
|
||||
{
|
||||
this.bone = null;
|
||||
|
||||
this.position = Vector3.zero;
|
||||
this.rotation = Quaternion.identity;
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93d692f5ab8246a09f9c272bab22296e
|
||||
timeCreated: 1741290854
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Animations;
|
||||
using UnityEngine.Animations.Rigging;
|
||||
|
||||
namespace VOID.Generic.Objects.Unit.Animations.Helpers
|
||||
{
|
||||
public struct ExtractTransformConstraintJob : IWeightedAnimationJob
|
||||
{
|
||||
public ReadWriteTransformHandle bone;
|
||||
|
||||
public FloatProperty jobWeight { get; set; }
|
||||
|
||||
public Vector3Property position;
|
||||
public Vector4Property rotation;
|
||||
|
||||
public void ProcessRootMotion(AnimationStream stream)
|
||||
{ }
|
||||
|
||||
public void ProcessAnimation(AnimationStream stream)
|
||||
{
|
||||
AnimationRuntimeUtils.PassThrough(stream, this.bone);
|
||||
|
||||
var pos = this.bone.GetPosition(stream);
|
||||
var rot = this.bone.GetRotation(stream);
|
||||
|
||||
this.position.Set(stream, pos);
|
||||
this.rotation.Set(stream, new Vector4(rot.x, rot.y, rot.z, rot.w));
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31e85282774544ca90f09d7cfb94503d
|
||||
timeCreated: 1741290825
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Animations.Rigging;
|
||||
|
||||
namespace VOID.Generic.Objects.Unit.Animations.Helpers
|
||||
{
|
||||
public class ExtractTransformConstraintJobBinder : AnimationJobBinder<
|
||||
ExtractTransformConstraintJob,
|
||||
ExtractTransformConstraintData>
|
||||
{
|
||||
public override ExtractTransformConstraintJob Create(Animator animator,
|
||||
ref ExtractTransformConstraintData data, Component component)
|
||||
{
|
||||
return new ExtractTransformConstraintJob
|
||||
{
|
||||
bone = ReadWriteTransformHandle.Bind(animator, data.bone),
|
||||
position = Vector3Property.Bind(animator, component, "m_Data." + nameof(data.position)),
|
||||
rotation = Vector4Property.Bind(animator, component, "m_Data." + nameof(data.rotation))
|
||||
};
|
||||
}
|
||||
|
||||
public override void Destroy(ExtractTransformConstraintJob job)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a3126a4f55234624853818c555c65eef
|
||||
timeCreated: 1741290841
|
||||
Reference in New Issue
Block a user