Skip to content

Commit

Permalink
Fixes to IK
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinerius committed Aug 10, 2023
1 parent 42caa2a commit f520eb2
Show file tree
Hide file tree
Showing 29 changed files with 1,157 additions and 260 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ AvatarMask:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: New Avatar Mask
m_Name: AvatarMask
m_Mask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
m_Elements:
- m_Path:
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1101 &-7988993525725839332
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -4050450968213979288}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.09402645
m_TransitionOffset: 0
m_ExitTime: 0.9
m_HasExitTime: 1
m_HasFixedDuration: 0
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &-7971650593490172519
AnimatorState:
serializedVersion: 6
Expand Down Expand Up @@ -211,7 +233,10 @@ AnimatorStateMachine:
m_Position: {x: 320, y: 200, z: 0}
- serializedVersion: 1
m_State: {fileID: 6626008193833255465}
m_Position: {x: 70, y: 200, z: 0}
m_Position: {x: 30, y: 200, z: 0}
- serializedVersion: 1
m_State: {fileID: 7720407666756339275}
m_Position: {x: 120, y: 320, z: 0}
m_ChildStateMachines:
- serializedVersion: 1
m_StateMachine: {fileID: -2772301717899763986}
Expand Down Expand Up @@ -571,6 +596,7 @@ AnimatorState:
- {fileID: 4615173915622944316}
- {fileID: 4302603106001568696}
- {fileID: -2920629328503316622}
- {fileID: 1204688441645205064}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
Expand Down Expand Up @@ -992,91 +1018,97 @@ AnimatorController:
m_DefaultFloat: 3
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: Jump
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: IsGrounded
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: EmoteLoop
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: Emote
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: EmoteRefresh
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: IsJumping
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: IsFalling
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: IsLongJump
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: RotateLeft
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: Angle
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: AngleDir
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: IsLongFall
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: IsStunned
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: WallHit
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: AFK
m_Type: 9
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
Expand Down Expand Up @@ -1198,6 +1230,28 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 0
--- !u!1101 &1204688441645205064
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions: []
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 7720407666756339275}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.05
m_TransitionOffset: 0
m_ExitTime: 0.7619048
m_HasExitTime: 0
m_HasFixedDuration: 0
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &1208421492764531611
AnimatorStateTransition:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -1969,6 +2023,34 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &7720407666756339275
AnimatorState:
serializedVersion: 6
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: AFK_Action
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -7988993525725839332}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
m_WriteDefaultValues: 1
m_Mirror: 0
m_SpeedParameterActive: 0
m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: 4304682399731470351, guid: 0aa2e273500b984418830b3285b404dd,
type: 3}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &7842504053680224278
AnimatorStateTransition:
m_ObjectHideFlags: 1
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;
using UnityEngine;

public class IKRuntimeConfiguration : MonoBehaviour
{
[SerializeField] private Transform[] objectsToReparent;
[SerializeField] private Transform parent;

public void Start()
{
foreach (Transform tr in objectsToReparent)
{
//tr.SetParent(parent, true);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using UnityEngine;
using UnityEngine.Animations.Rigging;

namespace MainScripts.DCL.Controllers.CharacterControllerV2.IK
{
[DisallowMultipleComponent]
[AddComponentMenu("Animation Rigging/Extract Transform Constraint")]
public class ExtractTransformConstraint : RigConstraint<
ExtractTransformConstraintJob,
ExtractTransformConstraintData,
ExtractTransformConstraintJobBinder>
{

}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using UnityEngine;
using UnityEngine.Animations.Rigging;

namespace MainScripts.DCL.Controllers.CharacterControllerV2.IK
{
[Serializable]
public struct ExtractTransformConstraintData : IAnimationJobData
{
[SyncSceneToStream] public Transform bone;

public Vector3 position;
public Quaternion rotation;
public Vector3 scale;

public bool IsValid() =>
bone != null;

public void SetDefaultValues()
{
this.bone = null;

this.position = Vector3.zero;
this.rotation = Quaternion.identity;
this.scale = Vector3.zero;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using UnityEngine;
using UnityEngine.Animations;
using UnityEngine.Animations.Rigging;

namespace MainScripts.DCL.Controllers.CharacterControllerV2.IK
{
public struct ExtractTransformConstraintJob : IWeightedAnimationJob
{
public ReadWriteTransformHandle bone;

public FloatProperty jobWeight { get; set; }

public Vector3Property position;
public Vector4Property rotation;
public Vector3Property scale;

public void ProcessRootMotion(AnimationStream stream) { }

public void ProcessAnimation(AnimationStream stream)
{
AnimationRuntimeUtils.PassThrough(stream, this.bone);

Vector3 pos = this.bone.GetLocalPosition(stream);
Quaternion rot = this.bone.GetLocalRotation(stream);
Vector3 sc = this.bone.GetLocalScale(stream);

this.position.Set(stream, pos);
this.scale.Set(stream, sc);
this.rotation.Set(stream, new Vector4(rot.x, rot.y, rot.z, rot.w));
}
}
}
Loading

0 comments on commit f520eb2

Please sign in to comment.