mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
move bunch of things to depricated folder
This commit is contained in:
parent
86828a94e2
commit
21f8893095
156 changed files with 193 additions and 93 deletions
|
@ -0,0 +1,132 @@
|
|||
using RootMotion.FinalIK;
|
||||
|
||||
namespace NAK.AlternateIKSystem.IK.WeightManipulators.BodyParts;
|
||||
|
||||
public abstract class BodyPart
|
||||
{
|
||||
protected float positionWeight = 1f;
|
||||
protected float rotationWeight = 1f;
|
||||
protected bool isEnabled = true;
|
||||
|
||||
public void SetPositionWeight(float weight)
|
||||
{
|
||||
this.positionWeight *= weight;
|
||||
}
|
||||
|
||||
public void SetRotationWeight(float weight)
|
||||
{
|
||||
this.rotationWeight *= weight;
|
||||
}
|
||||
|
||||
public void SetEnabled(bool isEnabled)
|
||||
{
|
||||
this.isEnabled = isEnabled;
|
||||
}
|
||||
|
||||
public abstract void ApplyWeightToSolver(IKSolverVR solver);
|
||||
}
|
||||
|
||||
public class Head : BodyPart
|
||||
{
|
||||
public override void ApplyWeightToSolver(IKSolverVR solver)
|
||||
{
|
||||
if (!isEnabled) return;
|
||||
solver.spine.positionWeight *= positionWeight;
|
||||
solver.spine.rotationWeight *= rotationWeight;
|
||||
}
|
||||
}
|
||||
|
||||
public class Pelvis : BodyPart
|
||||
{
|
||||
public override void ApplyWeightToSolver(IKSolverVR solver)
|
||||
{
|
||||
if (!isEnabled) return;
|
||||
solver.spine.pelvisPositionWeight *= positionWeight;
|
||||
solver.spine.pelvisRotationWeight *= rotationWeight;
|
||||
}
|
||||
}
|
||||
|
||||
public class LeftArm : BodyPart
|
||||
{
|
||||
private float bendGoalWeight = 1f;
|
||||
|
||||
public void SetBendGoalWeight(float weight)
|
||||
{
|
||||
this.bendGoalWeight *= weight;
|
||||
}
|
||||
|
||||
public override void ApplyWeightToSolver(IKSolverVR solver)
|
||||
{
|
||||
if (!isEnabled) return;
|
||||
|
||||
solver.leftArm.positionWeight *= positionWeight;
|
||||
solver.leftArm.rotationWeight *= rotationWeight;
|
||||
solver.leftArm.bendGoalWeight *= bendGoalWeight;
|
||||
}
|
||||
}
|
||||
|
||||
public class RightArm : BodyPart
|
||||
{
|
||||
private float bendGoalWeight = 1f;
|
||||
|
||||
public void SetBendGoalWeight(float weight)
|
||||
{
|
||||
this.bendGoalWeight *= weight;
|
||||
}
|
||||
|
||||
public override void ApplyWeightToSolver(IKSolverVR solver)
|
||||
{
|
||||
if (!isEnabled) return;
|
||||
|
||||
solver.rightArm.positionWeight *= positionWeight;
|
||||
solver.rightArm.rotationWeight *= rotationWeight;
|
||||
solver.rightArm.bendGoalWeight *= bendGoalWeight;
|
||||
}
|
||||
}
|
||||
|
||||
public class LeftLeg : BodyPart
|
||||
{
|
||||
private float bendGoalWeight = 1f;
|
||||
|
||||
public void SetBendGoalWeight(float weight)
|
||||
{
|
||||
this.bendGoalWeight *= weight;
|
||||
}
|
||||
|
||||
public override void ApplyWeightToSolver(IKSolverVR solver)
|
||||
{
|
||||
if (!isEnabled) return;
|
||||
|
||||
solver.leftLeg.positionWeight *= positionWeight;
|
||||
solver.leftLeg.rotationWeight *= rotationWeight;
|
||||
solver.leftLeg.bendGoalWeight *= bendGoalWeight;
|
||||
}
|
||||
}
|
||||
|
||||
public class RightLeg : BodyPart
|
||||
{
|
||||
private float bendGoalWeight = 1f;
|
||||
|
||||
public void SetBendGoalWeight(float weight)
|
||||
{
|
||||
this.bendGoalWeight *= weight;
|
||||
}
|
||||
|
||||
public override void ApplyWeightToSolver(IKSolverVR solver)
|
||||
{
|
||||
if (!isEnabled) return;
|
||||
|
||||
solver.rightLeg.positionWeight *= positionWeight;
|
||||
solver.rightLeg.rotationWeight *= rotationWeight;
|
||||
solver.rightLeg.bendGoalWeight *= bendGoalWeight;
|
||||
}
|
||||
}
|
||||
|
||||
public class Locomotion : BodyPart
|
||||
{
|
||||
public override void ApplyWeightToSolver(IKSolverVR solver)
|
||||
{
|
||||
if (!isEnabled) return;
|
||||
solver.locomotion.weight *= positionWeight;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
using NAK.AlternateIKSystem.IK.WeightManipulators.Interface;
|
||||
using RootMotion.FinalIK;
|
||||
|
||||
namespace NAK.AlternateIKSystem.IK.WeightManipulators;
|
||||
|
||||
public class DeviceControlManipulator : IWeightManipulator
|
||||
{
|
||||
public static bool shouldTrackAll = true;
|
||||
public static bool shouldTrackHead = true;
|
||||
public static bool shouldTrackPelvis = true;
|
||||
public static bool shouldTrackLeftArm = true;
|
||||
public static bool shouldTrackRightArm = true;
|
||||
public static bool shouldTrackLeftLeg = true;
|
||||
public static bool shouldTrackRightLeg = true;
|
||||
public static bool shouldTrackLocomotion = true;
|
||||
|
||||
public WeightManipulatorManager Manager { get; set; }
|
||||
|
||||
// Manipulator for Connected Devices (Has final say)
|
||||
public void Update(IKSolverVR solver)
|
||||
{
|
||||
Manager.TrackAll &= shouldTrackAll;
|
||||
Manager.TrackHead &= shouldTrackHead;
|
||||
Manager.TrackPelvis &= shouldTrackPelvis;
|
||||
Manager.TrackLeftArm &= shouldTrackLeftArm;
|
||||
Manager.TrackRightArm &= shouldTrackRightArm;
|
||||
Manager.TrackLeftLeg &= shouldTrackLeftLeg;
|
||||
Manager.TrackRightLeg &= shouldTrackRightLeg;
|
||||
Manager.TrackLocomotion &= shouldTrackLocomotion;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using RootMotion.FinalIK;
|
||||
|
||||
namespace NAK.AlternateIKSystem.IK.WeightManipulators.Interface;
|
||||
|
||||
public interface IWeightManipulator
|
||||
{
|
||||
WeightManipulatorManager Manager { get; set; }
|
||||
void Update(IKSolverVR solver);
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using NAK.AlternateIKSystem.IK.WeightManipulators.Interface;
|
||||
using RootMotion.FinalIK;
|
||||
|
||||
namespace NAK.AlternateIKSystem.IK.WeightManipulators;
|
||||
|
||||
public class TrackingControlManipulator : IWeightManipulator
|
||||
{
|
||||
public WeightManipulatorManager Manager { get; set; }
|
||||
|
||||
// Manipulator for External Control (Auto, State Behaviour)
|
||||
public void Update(IKSolverVR solver)
|
||||
{
|
||||
Manager.TrackAll |= BodyControl.TrackingAll;
|
||||
Manager.TrackHead |= BodyControl.TrackingHead;
|
||||
Manager.TrackPelvis |= BodyControl.TrackingPelvis;
|
||||
Manager.TrackLeftArm |= BodyControl.TrackingLeftArm;
|
||||
Manager.TrackRightArm |= BodyControl.TrackingRightArm;
|
||||
Manager.TrackLeftLeg |= BodyControl.TrackingLeftLeg;
|
||||
Manager.TrackRightLeg |= BodyControl.TrackingRightLeg;
|
||||
Manager.TrackLocomotion |= BodyControl.TrackingLocomotion;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
using NAK.AlternateIKSystem.IK.WeightManipulators.BodyParts;
|
||||
using NAK.AlternateIKSystem.IK.WeightManipulators.Interface;
|
||||
using RootMotion.FinalIK;
|
||||
|
||||
namespace NAK.AlternateIKSystem.IK.WeightManipulators;
|
||||
|
||||
public enum BodyPartEnum
|
||||
{
|
||||
Head,
|
||||
Pelvis,
|
||||
LeftArm,
|
||||
RightArm,
|
||||
LeftLeg,
|
||||
RightLeg,
|
||||
Locomotion,
|
||||
All
|
||||
}
|
||||
|
||||
public class WeightManipulatorManager
|
||||
{
|
||||
private readonly Dictionary<BodyPartEnum, BodyPart> _bodyParts = new Dictionary<BodyPartEnum, BodyPart>();
|
||||
|
||||
public WeightManipulatorManager()
|
||||
{
|
||||
_bodyParts.Add(BodyPartEnum.Head, new Head());
|
||||
_bodyParts.Add(BodyPartEnum.Pelvis, new Pelvis());
|
||||
_bodyParts.Add(BodyPartEnum.LeftArm, new LeftArm());
|
||||
_bodyParts.Add(BodyPartEnum.RightArm, new RightArm());
|
||||
_bodyParts.Add(BodyPartEnum.LeftLeg, new LeftLeg());
|
||||
_bodyParts.Add(BodyPartEnum.RightLeg, new RightLeg());
|
||||
_bodyParts.Add(BodyPartEnum.Locomotion, new Locomotion());
|
||||
}
|
||||
|
||||
public void SetWeight(BodyPartEnum bodyPartName, float positionWeight, float rotationWeight)
|
||||
{
|
||||
var bodyPart = _bodyParts[bodyPartName];
|
||||
bodyPart.SetPositionWeight(positionWeight);
|
||||
bodyPart.SetRotationWeight(rotationWeight);
|
||||
}
|
||||
|
||||
public void SetEnabled(BodyPartEnum bodyPartName, bool isEnabled)
|
||||
{
|
||||
var bodyPart = _bodyParts[bodyPartName];
|
||||
bodyPart.SetEnabled(isEnabled);
|
||||
}
|
||||
|
||||
public void ApplyWeightsToSolver(IKSolverVR solver)
|
||||
{
|
||||
foreach (var bodyPart in _bodyParts.Values)
|
||||
{
|
||||
bodyPart.ApplyWeightToSolver(solver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BodyControl
|
||||
{
|
||||
private readonly WeightManipulatorManager _manager;
|
||||
|
||||
public BodyControl(WeightManipulatorManager manager)
|
||||
{
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
public void SetWeight(string bodyPartName, float positionWeight, float rotationWeight)
|
||||
{
|
||||
_manager.SetWeight(bodyPartName, positionWeight, rotationWeight);
|
||||
}
|
||||
}
|
||||
|
||||
public class DeviceControl
|
||||
{
|
||||
private readonly WeightManipulatorManager _manager;
|
||||
|
||||
public DeviceControl(WeightManipulatorManager manager)
|
||||
{
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
public void SetEnabled(string bodyPartName, bool isEnabled)
|
||||
{
|
||||
_manager.SetEnabled(bodyPartName, isEnabled);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue