Skip to content

Commit

Permalink
Added documentation.pdf, updated voice proximity and room optimizatio…
Browse files Browse the repository at this point in the history
…n settings, fixed issues with frame-rate dependent rotation on android.
  • Loading branch information
David Liebemann committed Aug 2, 2022
1 parent 01b1bf3 commit 9459e0b
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 84 deletions.
52 changes: 0 additions & 52 deletions ODIN-SampleProject/Assets/AudioProcessingSettings.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ AudioSource:
Priority: 0
DopplerLevel: 1
MinDistance: 2
MaxDistance: 75
MaxDistance: 70
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1493,8 +1493,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 63afd9245694d6642ad7a3c26b266e2d, type: 3}
m_Name:
m_EditorClassIdentifier:
lookAxis: {fileID: -8589268155453388520, guid: 569da38d22d72724586e88d08c36b7a6, type: 3}
rotationSpeed: 150
gamepadAxis: {fileID: -8589268155453388520, guid: 569da38d22d72724586e88d08c36b7a6, type: 3}
mouseDelta: {fileID: 8009718129426777221, guid: 569da38d22d72724586e88d08c36b7a6, type: 3}
rotationSpeed: 0.6
mobileRotationSpeedMultiplier: 0.75
clampPitch: 80
yawTarget: {fileID: 2753487309498945351}
pitchTarget: {fileID: 2488659525853046605}
Expand Down
21 changes: 20 additions & 1 deletion ODIN-SampleProject/Assets/ODIN-Sample/Scenes/DemoLevel.unity
Original file line number Diff line number Diff line change
Expand Up @@ -20003,6 +20003,7 @@ GameObject:
m_Component:
- component: {fileID: 1312781870}
- component: {fileID: 1312781871}
- component: {fileID: 1312781872}
m_Layer: 5
m_Name: MobileControls
m_TagString: Untagged
Expand Down Expand Up @@ -20045,9 +20046,27 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 91e3ed22def442579b736836b90693ec, type: 3}
m_Name:
m_EditorClassIdentifier:
targetToActivate: {fileID: 1129041029}
targetsToActivate:
- {fileID: 1129041029}
stateToActivateOn: 0
viewState: {fileID: 11400000, guid: e535f44c0d04edb41a4bea2681c745fd, type: 2}
--- !u!114 &1312781872
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1312781869}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 91e3ed22def442579b736836b90693ec, type: 3}
m_Name:
m_EditorClassIdentifier:
targetsToActivate:
- {fileID: 1469584017}
- {fileID: 1282975345}
stateToActivateOn: 1
viewState: {fileID: 11400000, guid: e535f44c0d04edb41a4bea2681c745fd, type: 2}
--- !u!1001 &1320129881
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ODIN_Sample.Scripts.Runtime.GameLogic
{
public class ActivateOnViewState : MonoBehaviour
{
[SerializeField] private GameObject targetToActivate;
[SerializeField] private GameObject[] targetsToActivate;

[SerializeField] private SampleViewState.ViewState stateToActivateOn;

Expand Down Expand Up @@ -36,7 +36,12 @@ private void OnDisable()

private void UpdateOnViewStateSet(SampleViewState.ViewState newState)
{
targetToActivate.SetActive(newState == stateToActivateOn);
foreach (GameObject target in targetsToActivate)
{
target.SetActive(newState == stateToActivateOn);

}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@ namespace ODIN_Sample.Scripts.Runtime.GameLogic
/// </summary>
public class FirstPersonRotation : MonoBehaviour
{
[SerializeField] private InputActionReference lookAxis;
[SerializeField] private InputActionReference gamepadAxis;
[SerializeField] private InputActionReference mouseDelta;


/// <summary>
/// The rotation speed.
/// </summary>
[SerializeField] private float rotationSpeed = 200.0f;

/// <summary>
/// On mobile, a slower rotation speed is preferable.
/// </summary>
[SerializeField] private float mobileRotationSpeedMultiplier = 0.5f;


/// <summary>
/// The max angle the player can look up or down.
/// </summary>
Expand All @@ -41,18 +49,31 @@ private void Awake()
{
Assert.IsNotNull(yawTarget);
Assert.IsNotNull(pitchTarget);
Assert.IsNotNull(lookAxis);
lookAxis.action.Enable();
Assert.IsNotNull(gamepadAxis);
Assert.IsNotNull(mouseDelta);
gamepadAxis.action.Enable();
mouseDelta.action.Enable();
}

private void Update()
{
Vector2 lookInput = lookAxis.action.ReadValue<Vector2>();
float yaw = lookInput.x;
float pitch = lookInput.y;
Vector2 gamepadInput = gamepadAxis.action.ReadValue<Vector2>();
float yaw = gamepadInput.x * Time.deltaTime;
float pitch = gamepadInput.y * Time.deltaTime;

Vector2 mouseInput = mouseDelta.action.ReadValue<Vector2>();
yaw += mouseInput.x;
pitch += mouseInput.y;

float rotationSpeedMultiplier = rotationSpeed;

#if (UNITY_IPHONE || UNITY_ANDROID) && ! UNITY_EDITOR
rotationSpeedMultiplier *= mobileRotationSpeedMultiplier;
#endif


_currentYaw += yaw * rotationSpeed * Time.deltaTime;
_currentPitch += pitch * rotationSpeed * Time.deltaTime;
_currentYaw += yaw * rotationSpeedMultiplier;
_currentPitch += pitch * rotationSpeedMultiplier;
_currentPitch = Mathf.Clamp(_currentPitch, -clampPitch, clampPitch);

Quaternion yawRotation = Quaternion.Euler(yawTarget.transform.rotation.eulerAngles.x, _currentYaw, 0.0f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"initialStateCheck": true
},
{
"name": "FirstPersonCamera",
"name": "GamepadRight",
"type": "Value",
"id": "ed8f02da-60f7-4742-a400-aa339ffb32ba",
"expectedControlType": "Vector2",
Expand Down Expand Up @@ -112,6 +112,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": true
},
{
"name": "MouseDelta",
"type": "Value",
"id": "d919dad9-4abc-4979-a2a3-b5e8728b4671",
"expectedControlType": "Vector2",
"processors": "InvertVector2(invertX=false)",
"interactions": "",
"initialStateCheck": true
}
],
"bindings": [
Expand Down Expand Up @@ -274,20 +283,9 @@
"id": "55a526e4-a328-49cb-9060-90bc19e5848d",
"path": "<Gamepad>/rightStick",
"interactions": "",
"processors": "StickDeadzone",
"processors": "StickDeadzone(min=0.25,max=0.95),ScaleVector2(x=300,y=300)",
"groups": "",
"action": "FirstPersonCamera",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "16c51e0a-3e90-4c43-a7f8-56d083f19c23",
"path": "<Mouse>/delta",
"interactions": "",
"processors": "ScaleVector2(x=0.25,y=0.25)",
"groups": "",
"action": "FirstPersonCamera",
"action": "GamepadRight",
"isComposite": false,
"isPartOfComposite": false
},
Expand Down Expand Up @@ -455,6 +453,17 @@
"action": "ClickPosition",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "987c2517-7de0-45b9-8635-34897388549e",
"path": "<Mouse>/delta",
"interactions": "",
"processors": "",
"groups": "",
"action": "MouseDelta",
"isComposite": false,
"isPartOfComposite": false
}
]
}
Expand Down
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"roomName": "Voice",
"isActive": true,
"proximityRadius": 30.0
"proximityRadius": 70.0
}
]
}
2 changes: 1 addition & 1 deletion ODIN-SampleProject/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 0.16.1
bundleVersion: 0.16.2
preloadedAssets:
- {fileID: 0}
- {fileID: 0}
Expand Down

0 comments on commit 9459e0b

Please sign in to comment.