mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-04 07:19:22 +00:00
[DesktopVRIK] Remove test calibration stuff.
I didn't like how it made things look. Much more overcomplicated compared to what I had before. Goal was to test DesktopVRIKs calibrator with HalfbodyVRIK but im very lazy.
This commit is contained in:
parent
76a677e3e4
commit
a98b9e32d7
4 changed files with 65 additions and 148 deletions
|
@ -123,9 +123,9 @@ internal class DesktopVRIKCalibrator
|
||||||
Animator _animator;
|
Animator _animator;
|
||||||
|
|
||||||
// Calibration Objects
|
// Calibration Objects
|
||||||
public HumanPoseHandler _humanPoseHandler;
|
HumanPoseHandler _humanPoseHandler;
|
||||||
public HumanPose _humanPose;
|
HumanPose _humanPose;
|
||||||
public HumanPose _humanPoseInitial;
|
HumanPose _humanPoseInitial;
|
||||||
|
|
||||||
// Animator Info
|
// Animator Info
|
||||||
int _animLocomotionLayer = -1;
|
int _animLocomotionLayer = -1;
|
||||||
|
@ -198,14 +198,72 @@ internal class DesktopVRIKCalibrator
|
||||||
// Add and configure VRIK
|
// Add and configure VRIK
|
||||||
ikSystem.avatarVRIK = ikSystem.avatarTransform.AddComponentIfMissing<VRIK>();
|
ikSystem.avatarVRIK = ikSystem.avatarTransform.AddComponentIfMissing<VRIK>();
|
||||||
ikSystem.avatarVRIK.AutoDetectReferences();
|
ikSystem.avatarVRIK.AutoDetectReferences();
|
||||||
ikSystem.cachedSolver = new CachedSolver(ikSystem.avatarVRIK.solver);
|
|
||||||
|
|
||||||
// Why do I love to overcomplicate things?
|
// Why do I love to overcomplicate things?
|
||||||
VRIKUtils.ConfigureVRIKReferences(ikSystem.avatarVRIK, DesktopVRIK.EntryUseVRIKToes.Value);
|
VRIKUtils.ConfigureVRIKReferences(ikSystem.avatarVRIK, DesktopVRIK.EntryUseVRIKToes.Value);
|
||||||
VRIKConfigurator.ApplyVRIKConfiguration(ikSystem.cachedSolver, VRIKConfigurations.DesktopVRIKConfiguration());
|
|
||||||
|
|
||||||
// Fix potential animator issue
|
// Fix animator issue
|
||||||
ikSystem.avatarVRIK.fixTransforms = ikSystem.calibrationData.FixTransformsRequired;
|
ikSystem.avatarVRIK.fixTransforms = ikSystem.calibrationData.FixTransformsRequired;
|
||||||
|
|
||||||
|
CachedSolver solver = new CachedSolver(ikSystem.avatarVRIK.solver);
|
||||||
|
|
||||||
|
// Default solver settings
|
||||||
|
solver.Locomotion.weight = 0f;
|
||||||
|
solver.Locomotion.angleThreshold = 30f;
|
||||||
|
solver.Locomotion.maxLegStretch = 1f;
|
||||||
|
solver.Spine.minHeadHeight = 0f;
|
||||||
|
solver.Spine.chestClampWeight = 0f;
|
||||||
|
solver.Spine.maintainPelvisPosition = 0f;
|
||||||
|
solver.Solver.IKPositionWeight = 1f;
|
||||||
|
|
||||||
|
// Body leaning settings
|
||||||
|
solver.Spine.bodyPosStiffness = 1f;
|
||||||
|
solver.Spine.bodyRotStiffness = 0.2f;
|
||||||
|
// this is a hack, allows chest to rotate slightly
|
||||||
|
// independent from hip rotation. Funny Spine.Solve()->Bend()
|
||||||
|
solver.Spine.neckStiffness = 0.0001f;
|
||||||
|
|
||||||
|
// Disable locomotion
|
||||||
|
// Setting velocity to 0 aleviated nameplate jitter issue on remote
|
||||||
|
solver.Locomotion.velocityFactor = 0f;
|
||||||
|
solver.Locomotion.maxVelocity = 0f;
|
||||||
|
solver.Locomotion.rootSpeed = 1000f;
|
||||||
|
|
||||||
|
// Disable chest rotation by hands
|
||||||
|
// this fixed Effector, Player Arm Movement, BetterInteractDesktop, ect
|
||||||
|
// from making entire body shake, as well as while running
|
||||||
|
solver.Spine.rotateChestByHands = 0f;
|
||||||
|
|
||||||
|
// Prioritize LookAtIK
|
||||||
|
solver.Spine.headClampWeight = 0.2f;
|
||||||
|
|
||||||
|
// Disable going on tippytoes
|
||||||
|
solver.Spine.positionWeight = 0f;
|
||||||
|
solver.Spine.rotationWeight = 1f;
|
||||||
|
|
||||||
|
// Set so emotes play properly
|
||||||
|
solver.Spine.maxRootAngle = 180f;
|
||||||
|
// this is different in VR, as CVR player controller is not set up optimally for VRIK.
|
||||||
|
// Desktop avatar rotates 1:1 with _PlayerLocal. VR has a disconnect because you can turn IRL.
|
||||||
|
|
||||||
|
// We disable these ourselves now, as we no longer use BodySystem
|
||||||
|
solver.Spine.maintainPelvisPosition = 1f;
|
||||||
|
solver.Spine.positionWeight = 0f;
|
||||||
|
solver.Spine.pelvisPositionWeight = 0f;
|
||||||
|
solver.LeftArm.positionWeight = 0f;
|
||||||
|
solver.LeftArm.rotationWeight = 0f;
|
||||||
|
solver.RightArm.positionWeight = 0f;
|
||||||
|
solver.RightArm.rotationWeight = 0f;
|
||||||
|
solver.LeftLeg.positionWeight = 0f;
|
||||||
|
solver.LeftLeg.rotationWeight = 0f;
|
||||||
|
solver.RightLeg.positionWeight = 0f;
|
||||||
|
solver.RightLeg.rotationWeight = 0f;
|
||||||
|
|
||||||
|
// This is now our master Locomotion weight
|
||||||
|
solver.Locomotion.weight = 1f;
|
||||||
|
solver.Solver.IKPositionWeight = 1f;
|
||||||
|
|
||||||
|
ikSystem.cachedSolver = solver;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrateVRIK()
|
void CalibrateVRIK()
|
||||||
|
|
|
@ -42,7 +42,6 @@ internal class DesktopVRIKSystem : MonoBehaviour
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
|
||||||
Calibrator = new DesktopVRIKCalibrator();
|
Calibrator = new DesktopVRIKCalibrator();
|
||||||
|
|
||||||
playerSetup = GetComponent<PlayerSetup>();
|
playerSetup = GetComponent<PlayerSetup>();
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
namespace NAK.DesktopVRIK.VRIKHelper;
|
|
||||||
|
|
||||||
public class VRIKConfiguration
|
|
||||||
{
|
|
||||||
// Solver settings
|
|
||||||
public float LocomotionWeight { get; set; }
|
|
||||||
public float LocomotionAngleThreshold { get; set; }
|
|
||||||
public float LocomotionMaxLegStretch { get; set; }
|
|
||||||
public float SpineMinHeadHeight { get; set; }
|
|
||||||
public float SolverIKPositionWeight { get; set; }
|
|
||||||
public float SpineChestClampWeight { get; set; }
|
|
||||||
public float SpineMaintainPelvisPosition { get; set; }
|
|
||||||
|
|
||||||
// Body leaning settings
|
|
||||||
public float SpineBodyPosStiffness { get; set; }
|
|
||||||
public float SpineBodyRotStiffness { get; set; }
|
|
||||||
public float SpineNeckStiffness { get; set; }
|
|
||||||
|
|
||||||
// Locomotion settings
|
|
||||||
public float LocomotionVelocityFactor { get; set; }
|
|
||||||
public float LocomotionMaxVelocity { get; set; }
|
|
||||||
public float LocomotionRootSpeed { get; set; }
|
|
||||||
|
|
||||||
// Chest rotation
|
|
||||||
public float SpineRotateChestByHands { get; set; }
|
|
||||||
|
|
||||||
public float SpineHeadClampWeight { get; set; }
|
|
||||||
|
|
||||||
public float SpinePositionWeight { get; set; }
|
|
||||||
public float SpineRotationWeight { get; set; }
|
|
||||||
|
|
||||||
public float SpineMaxRootAngle { get; set; }
|
|
||||||
|
|
||||||
// BodySystem
|
|
||||||
public float SpinePelvisPositionWeight { get; set; }
|
|
||||||
public float LeftArmPositionWeight { get; set; }
|
|
||||||
public float LeftArmRotationWeight { get; set; }
|
|
||||||
public float RightArmPositionWeight { get; set; }
|
|
||||||
public float RightArmRotationWeight { get; set; }
|
|
||||||
public float LeftLegPositionWeight { get; set; }
|
|
||||||
public float LeftLegRotationWeight { get; set; }
|
|
||||||
public float RightLegPositionWeight { get; set; }
|
|
||||||
public float RightLegRotationWeight { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class VRIKConfigurator
|
|
||||||
{
|
|
||||||
public static void ApplyVRIKConfiguration(CachedSolver cachedSolver, VRIKConfiguration config)
|
|
||||||
{
|
|
||||||
cachedSolver.Solver.IKPositionWeight = config.SolverIKPositionWeight;
|
|
||||||
cachedSolver.Locomotion.weight = config.LocomotionWeight;
|
|
||||||
cachedSolver.Locomotion.angleThreshold = config.LocomotionAngleThreshold;
|
|
||||||
cachedSolver.Locomotion.maxLegStretch = config.LocomotionMaxLegStretch;
|
|
||||||
|
|
||||||
cachedSolver.Spine.chestClampWeight = config.SpineChestClampWeight;
|
|
||||||
cachedSolver.Spine.maintainPelvisPosition = config.SpineMaintainPelvisPosition;
|
|
||||||
cachedSolver.Spine.minHeadHeight = config.SpineMinHeadHeight;
|
|
||||||
|
|
||||||
cachedSolver.Spine.bodyPosStiffness = config.SpineBodyPosStiffness;
|
|
||||||
cachedSolver.Spine.bodyRotStiffness = config.SpineBodyRotStiffness;
|
|
||||||
cachedSolver.Spine.neckStiffness = config.SpineNeckStiffness;
|
|
||||||
|
|
||||||
cachedSolver.Locomotion.velocityFactor = config.LocomotionVelocityFactor;
|
|
||||||
cachedSolver.Locomotion.maxVelocity = config.LocomotionMaxVelocity;
|
|
||||||
cachedSolver.Locomotion.rootSpeed = config.LocomotionRootSpeed;
|
|
||||||
|
|
||||||
cachedSolver.Spine.rotateChestByHands = config.SpineRotateChestByHands;
|
|
||||||
|
|
||||||
cachedSolver.Spine.headClampWeight = config.SpineHeadClampWeight;
|
|
||||||
|
|
||||||
cachedSolver.Spine.positionWeight = config.SpinePositionWeight;
|
|
||||||
cachedSolver.Spine.rotationWeight = config.SpineRotationWeight;
|
|
||||||
|
|
||||||
cachedSolver.Spine.maxRootAngle = config.SpineMaxRootAngle;
|
|
||||||
|
|
||||||
cachedSolver.Spine.maintainPelvisPosition = config.SpineMaintainPelvisPosition;
|
|
||||||
cachedSolver.Spine.pelvisPositionWeight = config.SpinePelvisPositionWeight;
|
|
||||||
cachedSolver.LeftArm.positionWeight = config.LeftArmPositionWeight;
|
|
||||||
cachedSolver.LeftArm.rotationWeight = config.LeftArmRotationWeight;
|
|
||||||
cachedSolver.RightArm.positionWeight = config.RightArmPositionWeight;
|
|
||||||
cachedSolver.RightArm.rotationWeight = config.RightArmRotationWeight;
|
|
||||||
cachedSolver.LeftLeg.positionWeight = config.LeftLegPositionWeight;
|
|
||||||
cachedSolver.LeftLeg.rotationWeight = config.LeftLegRotationWeight;
|
|
||||||
cachedSolver.RightLeg.positionWeight = config.RightLegPositionWeight;
|
|
||||||
cachedSolver.RightLeg.rotationWeight = config.RightLegRotationWeight;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,53 +0,0 @@
|
||||||
namespace NAK.DesktopVRIK.VRIKHelper;
|
|
||||||
|
|
||||||
public static class VRIKConfigurations
|
|
||||||
{
|
|
||||||
public static VRIKConfiguration DesktopVRIKConfiguration()
|
|
||||||
{
|
|
||||||
return new VRIKConfiguration
|
|
||||||
{
|
|
||||||
// Solver settings
|
|
||||||
LocomotionWeight = 0f,
|
|
||||||
LocomotionAngleThreshold = 30f,
|
|
||||||
LocomotionMaxLegStretch = 1f,
|
|
||||||
SpineMinHeadHeight = 0f,
|
|
||||||
SolverIKPositionWeight = 1f,
|
|
||||||
SpineChestClampWeight = 0f,
|
|
||||||
SpineMaintainPelvisPosition = 1f,
|
|
||||||
|
|
||||||
// Body leaning settings
|
|
||||||
SpineBodyPosStiffness = 1f,
|
|
||||||
SpineBodyRotStiffness = 0.2f,
|
|
||||||
SpineNeckStiffness = 0.0001f, //hack
|
|
||||||
|
|
||||||
// Locomotion settings
|
|
||||||
LocomotionVelocityFactor = 0f,
|
|
||||||
LocomotionMaxVelocity = 0f,
|
|
||||||
LocomotionRootSpeed = 1000f,
|
|
||||||
|
|
||||||
// Chest rotation
|
|
||||||
SpineRotateChestByHands = 0f, //pam, bid, leap motion change
|
|
||||||
|
|
||||||
// LookAtIK priority
|
|
||||||
SpineHeadClampWeight = 0.2f,
|
|
||||||
|
|
||||||
// Tippytoes
|
|
||||||
SpinePositionWeight = 0f,
|
|
||||||
SpineRotationWeight = 1f,
|
|
||||||
|
|
||||||
// Emotes
|
|
||||||
SpineMaxRootAngle = 180f,
|
|
||||||
|
|
||||||
// BodySystem
|
|
||||||
SpinePelvisPositionWeight = 0f,
|
|
||||||
LeftArmPositionWeight = 0f,
|
|
||||||
LeftArmRotationWeight = 0f,
|
|
||||||
RightArmPositionWeight = 0f,
|
|
||||||
RightArmRotationWeight = 0f,
|
|
||||||
LeftLegPositionWeight = 0f,
|
|
||||||
LeftLegRotationWeight = 0f,
|
|
||||||
RightLegPositionWeight = 0f,
|
|
||||||
RightLegRotationWeight = 0f,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue