mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 14:29:25 +00:00
touchy
This commit is contained in:
parent
05979d9542
commit
20222e563e
2 changed files with 11 additions and 15 deletions
|
@ -24,14 +24,14 @@ public class DesktopVRIK : MonoBehaviour
|
||||||
Setting_ChestHeadingWeight;
|
Setting_ChestHeadingWeight;
|
||||||
|
|
||||||
// Internal Stuff
|
// Internal Stuff
|
||||||
private float
|
bool ps_emoteIsPlaying;
|
||||||
ik_SimulatedRootAngle;
|
float ik_SimulatedRootAngle;
|
||||||
private bool
|
Transform desktopCameraTransform;
|
||||||
ps_emoteIsPlaying;
|
|
||||||
static readonly FieldInfo ms_isGrounded = typeof(MovementSystem).GetField("_isGrounded", BindingFlags.NonPublic | BindingFlags.Instance);
|
static readonly FieldInfo ms_isGrounded = typeof(MovementSystem).GetField("_isGrounded", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
desktopCameraTransform = PlayerSetup.Instance.desktopCamera.transform;
|
||||||
Calibrator = new DesktopVRIKCalibrator();
|
Calibrator = new DesktopVRIKCalibrator();
|
||||||
Instance = this;
|
Instance = this;
|
||||||
DesktopVRIKMod.UpdateAllSettings();
|
DesktopVRIKMod.UpdateAllSettings();
|
||||||
|
@ -72,8 +72,8 @@ public class DesktopVRIK : MonoBehaviour
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
ps_emoteIsPlaying = isEmotePlaying;
|
ps_emoteIsPlaying = isEmotePlaying;
|
||||||
Calibrator.vrik.transform.localPosition = Vector3.zero;
|
Calibrator.avatarTransform.localPosition = Vector3.zero;
|
||||||
Calibrator.vrik.transform.localRotation = Quaternion.identity;
|
Calibrator.avatarTransform.localRotation = Quaternion.identity;
|
||||||
if (Calibrator.lookAtIK != null)
|
if (Calibrator.lookAtIK != null)
|
||||||
{
|
{
|
||||||
Calibrator.lookAtIK.enabled = !isEmotePlaying;
|
Calibrator.lookAtIK.enabled = !isEmotePlaying;
|
||||||
|
@ -104,22 +104,19 @@ public class DesktopVRIK : MonoBehaviour
|
||||||
weight *= isGrounded ? 1f : 0f;
|
weight *= isGrounded ? 1f : 0f;
|
||||||
|
|
||||||
// Reset avatar offset (VRIK will literally make you walk away from root otherwise)
|
// Reset avatar offset (VRIK will literally make you walk away from root otherwise)
|
||||||
Calibrator.vrik.transform.localPosition = Vector3.zero;
|
Calibrator.avatarTransform.localPosition = Vector3.zero;
|
||||||
Calibrator.vrik.transform.localRotation = Quaternion.identity;
|
Calibrator.avatarTransform.localRotation = Quaternion.identity;
|
||||||
|
|
||||||
// Plant feet is nice for Desktop
|
// Plant feet is nice for Desktop
|
||||||
Calibrator.vrik.solver.plantFeet = Setting_PlantFeet;
|
Calibrator.vrik.solver.plantFeet = Setting_PlantFeet;
|
||||||
|
|
||||||
// This is nice for walk cycles
|
|
||||||
//Calibrator.vrik.solver.spine.rotateChestByHands = Setting_RotateChestByHands * weight;
|
|
||||||
|
|
||||||
// Old VRChat hip movement emulation
|
// Old VRChat hip movement emulation
|
||||||
if (Setting_BodyLeanWeight > 0)
|
if (Setting_BodyLeanWeight > 0)
|
||||||
{
|
{
|
||||||
float weightedAngle = Setting_BodyLeanWeight * weight;
|
float weightedAngle = Setting_BodyLeanWeight * weight;
|
||||||
float angle = PlayerSetup.Instance.desktopCamera.transform.localEulerAngles.x;
|
float angle = desktopCameraTransform.localEulerAngles.x;
|
||||||
angle = (angle > 180) ? angle - 360 : angle;
|
angle = (angle > 180) ? angle - 360 : angle;
|
||||||
Quaternion rotation = Quaternion.AngleAxis(angle * weightedAngle, IKSystem.Instance.avatar.transform.right);
|
Quaternion rotation = Quaternion.AngleAxis(angle * weightedAngle, Calibrator.avatarTransform.right);
|
||||||
Calibrator.vrik.solver.AddRotationOffset(IKSolverVR.RotationOffset.Head, rotation);
|
Calibrator.vrik.solver.AddRotationOffset(IKSolverVR.RotationOffset.Head, rotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,6 @@ public class DesktopVRIKCalibrator
|
||||||
DesktopVRIK.ScaleStepHeight(vrik.solver.locomotion.stepHeight, initialStepHeight);
|
DesktopVRIK.ScaleStepHeight(vrik.solver.locomotion.stepHeight, initialStepHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void SetupDesktopHeadIKTarget()
|
private void SetupDesktopHeadIKTarget()
|
||||||
{
|
{
|
||||||
// Lazy HeadIKTarget calibration
|
// Lazy HeadIKTarget calibration
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue