Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Commit

Permalink
Scale affects movement speed
Browse files Browse the repository at this point in the history
  • Loading branch information
Keelhauled committed Sep 24, 2017
1 parent d800d00 commit c948b97
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions LockOnNeoPlugin/NeoMono.cs
Original file line number Diff line number Diff line change
Expand Up @@ -427,15 +427,16 @@ protected override void GamepadControls()
//if(toggle) toggle.GetComponent<Toggle>().isOn = false;
}

if(!rotatingInPov) currentCharaOCI.animeSpeed = rightStick.magnitude * animMoveSets[animMoveSetCurrent].animSpeed;
float animSpeed = animMoveSets[animMoveSetCurrent].animSpeed * currentCharaOCI.guideObject.changeAmount.scale.z;
if(!rotatingInPov) currentCharaOCI.animeSpeed = rightStick.magnitude * animSpeed / currentCharaOCI.guideObject.changeAmount.scale.z;
rightStick = rightStick * 0.04f;

if(studio.cameraCtrl.enabled)
{
Vector3 forward = Vector3.Scale(Camera.main.transform.forward, new Vector3(1f, 0f, 1f)).normalized;
Vector3 lookDirection = Camera.main.transform.right * rightStick.x + forward * -rightStick.y;
lookDirection = new Vector3(lookDirection.x, 0f, lookDirection.z);
currentCharaOCI.guideObject.changeAmount.pos += lookDirection * Time.deltaTime * (animMoveSets[animMoveSetCurrent].animSpeed * animMoveSets[animMoveSetCurrent].speedMult);
currentCharaOCI.guideObject.changeAmount.pos += lookDirection * Time.deltaTime * (animSpeed * animMoveSets[animMoveSetCurrent].speedMult);
Quaternion lookRotation = Quaternion.LookRotation(lookDirection, Vector3.up);
Quaternion finalRotation = Quaternion.RotateTowards(Quaternion.Euler(currentCharaOCI.guideObject.changeAmount.rot), lookRotation, Time.deltaTime * 60f * 10f);
currentCharaOCI.guideObject.changeAmount.rot = finalRotation.eulerAngles;
Expand All @@ -445,7 +446,7 @@ protected override void GamepadControls()
Vector3 forward = Vector3.Scale(currentCharaInfo.transform.forward, new Vector3(1f, 0f, 1f)).normalized;
Vector3 lookDirection = forward * -rightStick.y;
lookDirection = new Vector3(lookDirection.x, 0f, lookDirection.z);
currentCharaOCI.guideObject.changeAmount.pos += lookDirection * Time.deltaTime * (animMoveSets[animMoveSetCurrent].animSpeed * animMoveSets[animMoveSetCurrent].speedMult);
currentCharaOCI.guideObject.changeAmount.pos += lookDirection * Time.deltaTime * (animSpeed * animMoveSets[animMoveSetCurrent].speedMult);
currentCharaOCI.guideObject.changeAmount.rot += new Vector3(0f, rightStick.x * Time.deltaTime * 60f * 100f, 0f);
}
}
Expand Down

0 comments on commit c948b97

Please sign in to comment.