Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Created August 5, 2017 03:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flushpot1125/fe5ed2a4f262de4e76d6f60626a3a64c to your computer and use it in GitHub Desktop.
Save flushpot1125/fe5ed2a4f262de4e76d6f60626a3a64c to your computer and use it in GitHub Desktop.
private Vector3 GetCameraControlTranslation()
{
InputDev inputDev = InputDev.Instance;
Vector3 deltaPosition = Vector3.zero;
//deltaPosition += GetKeyDir("left", "right") * Camera.main.transform.right; //ここをコメントアウトする
//deltaPosition += GetKeyDir("down", "up") * Camera.main.transform.forward; //ここをコメントアウトする
// Support fly up/down keypresses if the current project maps it. This isn't a standard
// Unity InputManager mapping, so it has to gracefully fail if unavailable.
if (this.isFlyKeypressEnabled)
{
try
{
deltaPosition += InputCurve(Input.GetAxis("Fly")) * m_Veil.transform.up;
}
catch (System.Exception)
{
this.isFlyKeypressEnabled = false;
}
}
// All input should come through inputDev, someday
deltaPosition += InputCurve(inputDev.VirtualCamTranslate.delta.x) * this.transform.right;
deltaPosition += InputCurve(inputDev.VirtualCamTranslate.delta.y) * this.transform.forward;
deltaPosition += InputCurve(inputDev.VirtualCamVertAndRoll.delta.x) * this.transform.up;
float accel = Input.GetKey(KeyCode.LeftShift) ? 1.0f : 0.1f;
return accel * deltaPosition;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment