Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Commit

Permalink
Updated Unity Input Module
Browse files Browse the repository at this point in the history
You can now choose axis to be used for looking instead of the default Mouse X & Mouse Y
  • Loading branch information
Moe-Baker committed Jan 3, 2018
1 parent 32ef146 commit 8a13256
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 10 deletions.
Binary file modified Advanced Rigidbody FirstPerson Controller.unitypackage
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ Prefab:
- target: {fileID: 54388483204585682, guid: 24342b97cca99854884a9bd3de4fd0a4,
type: 2}
propertyPath: m_Constraints
value: 118
value: 0
objectReference: {fileID: 0}
- target: {fileID: 65558941031378108, guid: 24342b97cca99854884a9bd3de4fd0a4,
type: 2}
Expand All @@ -777,6 +777,11 @@ Prefab:
propertyPath: m_Mass
value: 40
objectReference: {fileID: 0}
- target: {fileID: 54388483204585682, guid: 24342b97cca99854884a9bd3de4fd0a4,
type: 2}
propertyPath: m_IsKinematic
value: 1
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 145220160338266618, guid: 24342b97cca99854884a9bd3de4fd0a4, type: 2}
m_ParentPrefab: {fileID: 100100000, guid: 24342b97cca99854884a9bd3de4fd0a4, type: 2}
Expand Down Expand Up @@ -3277,7 +3282,7 @@ Prefab:
- target: {fileID: 224829089356372096, guid: cbd85c13b2088be4a91725f72d37ace9,
type: 2}
propertyPath: m_AnchoredPosition.y
value: -10
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224829089356372096, guid: cbd85c13b2088be4a91725f72d37ace9,
type: 2}
Expand All @@ -3287,7 +3292,7 @@ Prefab:
- target: {fileID: 224829089356372096, guid: cbd85c13b2088be4a91725f72d37ace9,
type: 2}
propertyPath: m_SizeDelta.y
value: 16
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224688007721596926, guid: cbd85c13b2088be4a91725f72d37ace9,
type: 2}
Expand All @@ -3297,7 +3302,7 @@ Prefab:
- target: {fileID: 224688007721596926, guid: cbd85c13b2088be4a91725f72d37ace9,
type: 2}
propertyPath: m_SizeDelta.y
value: 36
value: 0
objectReference: {fileID: 0}
- target: {fileID: 224688007721596926, guid: cbd85c13b2088be4a91725f72d37ace9,
type: 2}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,27 @@ public class FPControllerUnityInput : FPControllerInputModule
string leanAxis = "Lean";
public string LeanAxis { get { return leanAxis; } }

[SerializeField]
protected LookAxisData lookAxis = new LookAxisData("Look");
public LookAxisData LookAxis { get { return lookAxis; } }
[Serializable]
public struct LookAxisData
{
[SerializeField]
string x;
public string X { get { return x; } }

[SerializeField]
string y;
public string Y { get { return y; } }

public LookAxisData(string axisName)
{
x = axisName + " X";
y = axisName + " Y";
}
}

[SerializeField]
string jumpButton = "Jump";
public string JumpButton { get { return jumpButton; } }
Expand All @@ -58,8 +79,8 @@ public override void UpdateInput()

lean = Input.GetAxisRaw(leanAxis);

look.x = Input.GetAxis("Mouse X");
look.y = Input.GetAxis("Mouse Y");
look.x = Input.GetAxis(lookAxis.X);
look.y = Input.GetAxis(lookAxis.Y);

jump = Input.GetButtonDown(jumpButton);
sprint = Input.GetButton(sprintButton);
Expand Down
88 changes: 84 additions & 4 deletions ProjectSettings/InputManager.asset
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ InputManager:
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton: joystick button 3
positiveButton: joystick button 0
altNegativeButton:
altPositiveButton:
gravity: 1000
Expand Down Expand Up @@ -300,7 +300,7 @@ InputManager:
negativeButton:
positiveButton: left shift
altNegativeButton:
altPositiveButton:
altPositiveButton: joystick button 8
gravity: 1000
dead: 0.001
sensitivity: 1000
Expand All @@ -316,7 +316,7 @@ InputManager:
negativeButton:
positiveButton: c
altNegativeButton:
altPositiveButton:
altPositiveButton: joystick button 1
gravity: 1000
dead: 0.001
sensitivity: 1000
Expand All @@ -332,7 +332,7 @@ InputManager:
negativeButton:
positiveButton: left ctrl
altNegativeButton:
altPositiveButton:
altPositiveButton: joystick button 2
gravity: 1000
dead: 0.001
sensitivity: 1000
Expand All @@ -357,3 +357,83 @@ InputManager:
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Lean
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 1
dead: 0.2
sensitivity: 1
snap: 0
invert: 1
type: 2
axis: 2
joyNum: 0
- serializedVersion: 3
m_Name: Look X
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.1
sensitivity: 1
snap: 0
invert: 0
type: 2
axis: 3
joyNum: 0
- serializedVersion: 3
m_Name: Look Y
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0.1
sensitivity: 1
snap: 0
invert: 1
type: 2
axis: 4
joyNum: 0
- serializedVersion: 3
m_Name: Look X
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Look Y
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 0
dead: 0
sensitivity: 0.1
snap: 0
invert: 0
type: 1
axis: 1
joyNum: 0

0 comments on commit 8a13256

Please sign in to comment.