Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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